0
HELP
#include <iostream> using namespace std; int main() { int f=1; for(int a=40; a>=1 ; --a) { f*=a; cout << f<<endl; } return 0; } What is the error in this code ?
3 Answers
+ 2
forty factorial is a very large number. So, you can't store it's value in int variable.
0
ohh shit , I should have used a larger data type like long double , thanks man
0
Aveek Bhattacharyya Using long double for factorials is 'not' a good idea.
https://www.sololearn.com/discuss/348499/?ref=app



