Skip to content

Instantly share code, notes, and snippets.

@aligalehban
Created June 21, 2018 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aligalehban/305ca1a7046733c158d164911d6f27a0 to your computer and use it in GitHub Desktop.
Save aligalehban/305ca1a7046733c158d164911d6f27a0 to your computer and use it in GitHub Desktop.
Find Factorial of number in c++ source code - www.alighalehban.com
#include <iostream>
using namespace std;
int main()
{
unsigned int n;
unsigned long long factorial = 1;
cout << "Enter a positive integer: ";
cin >> n;
for(int i = 1; i <=n; ++i)
{
factorial *= i;
}
cout << "Factorial of " << n << " = " << factorial;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment