0
How can we make a code for Factorial in cpp?
Factorial in cpp
14 Antworten
+ 2
cin>>num;
int fact=1,i=1;
for(i=1;i<=num;i++)
{
fact*=i;
}
cout<<"Factorial of given number is"<<fact;
logic is same but syntax is different, so don't worry about syntax.
+ 1
Still can u explain it now
+ 1
It doesn't work
+ 1
Ty! But that's java😓
+ 1
Thanks!
+ 1
Maybe I m doing some silly mistake
Please check it. Thanks
https://code.sololearn.com/ce249b94wtki/?ref=app
+ 1
Ty its working😄
+ 1
The code is working well till 12 but doesn't work after that. What is the problem
https://code.sololearn.com/c6sW08HJI6Kv/?ref=app
+ 1
Thanks 😊
+ 1
It's done @ Abhinav Kumar thanks
0
remove semicolon at the end in for loop.
0
use long data type bro rather than int
0
its damn easy