0

How can we make a code for Factorial in cpp?

Factorial in cpp

29th Oct 2017, 12:40 PM
Kinjal
Kinjal - avatar
14 Answers
29th Oct 2017, 12:51 PM
Nanda Balakrishnan
+ 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.
29th Oct 2017, 12:55 PM
Nanda Balakrishnan
+ 1
Still can u explain it now
29th Oct 2017, 12:41 PM
Kinjal
Kinjal - avatar
+ 1
It doesn't work
29th Oct 2017, 12:48 PM
Kinjal
Kinjal - avatar
+ 1
Ty! But that's java😓
29th Oct 2017, 12:53 PM
Kinjal
Kinjal - avatar
+ 1
Thanks!
29th Oct 2017, 1:04 PM
Kinjal
Kinjal - avatar
+ 1
Maybe I m doing some silly mistake Please check it. Thanks https://code.sololearn.com/ce249b94wtki/?ref=app
29th Oct 2017, 1:07 PM
Kinjal
Kinjal - avatar
+ 1
Ty its working😄
29th Oct 2017, 1:12 PM
Kinjal
Kinjal - avatar
+ 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
2nd Nov 2017, 2:46 PM
Kinjal
Kinjal - avatar
+ 1
Thanks 😊
4th Nov 2017, 2:06 PM
Kinjal
Kinjal - avatar
+ 1
It's done @ Abhinav Kumar thanks
7th Nov 2017, 1:30 PM
Kinjal
Kinjal - avatar
0
remove semicolon at the end in for loop.
29th Oct 2017, 1:09 PM
Nanda Balakrishnan
0
use long data type bro rather than int
2nd Nov 2017, 3:25 PM
Nanda Balakrishnan
0
its damn easy
7th Nov 2017, 1:23 PM
Abhinav Kumar
Abhinav Kumar - avatar