C++ Program to Find Factorial of Large Numbers

In this C++ program, we will have a look at the C++ Program to Find Factorial of Large Numbers.

C++ Program to Find Factorial of Large Numbers

#include <iostream>
using namespace std;
int fact(unsigned long long int num) {
if (num == 0 || num == 1)
return 1;
else
return num * fact(num - 1);
}
int main() {
unsigned long long int num;
cout<<"Please enter number: \n";
cin>>n;
cout<< “Factorial: “ << fact(num);
return 0;
}

Output

Please enter number: 5
Factorial: 120


		

Leave a Reply

Your email address will not be published. Required fields are marked *

Shopping cart