Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 3
Can anyone explain what is wrong with this code
6 Answers
+ 2
factorial of 15 is a big number that is not fit to int variable.
Use long long int type instead of int. Also replace format specifiers with %lld
+ 5
Thanks
+ 2
Thanks
+ 1
variable k in function fact() is not initialized.
line #33 should be
int k = 1,i;
+ 1
Now it's working it's not giving the expected output if input >14
Why?
0
Now you code can generate 20 lines. With some refactoring you can do 30. Without using big int.