How To Calculate 1000 Factorial In C++ Code Example


Example: program to calculate factorial of number in c++

#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; }

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable