how to solve the factorial program of c++

Please be more specific about the nature of your difficulty. Please post your code.

please clearly tell your problem while if you mean a "factorial Finding" program , you have it!

give different arguments to "fact() " function to have different factorials

#include <cstdlib>
#include <iostream>

using namespace std;
int fact(int n)
{
 if(n>1)
        return n*fact(n-1);

 else if(n==1 || n==0)
        return 1;
 
}
int main(int argc, char *argv[])
{

    int factorial =fact(3);
    cout<<factorial<<endl;
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
commented: Giving out code on a platter does not help the OP +0
commented: You haven't helped him. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.