+ 2
How to find factorial of 100 ?
c++
9 Respostas
+ 13
You'll have to use a double or Big Integer
Source: http://stackoverflow.com/questions/23867050/what-data-type-can-store-a-factorial-of-100
+ 12
int fact = 1;
for loop from x = 1 to x = 100
fact *= x;
+ 1
no @jafca value cannot be stored in int because it is too long.
+ 1
This might help but results shall be in scientific notation
#include <iostream>
using namespace std;
int main() {
double x=100,p=1;
while (x>1){
p *= x;
x -= 1;
}
cout<<p;
return 0;
}
0
using c++ only!!
0
@moksh makhija
0
#include <iostream>
using namespace std;
int main() {
int sum = 1:
int input;
cout << "Enter a number: "<<endle;
cin >>input ;
for (int a=1; a<=input; a++){
sum += a;
}
cout << sum ;
return 0;
}
0
Enter 100 in input and see...
# Using Python
https://code.sololearn.com/cM4VQXlTNKYF/?ref=app