To find the factorial of a number using for loop | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

To find the factorial of a number using for loop

go

15th Nov 2017, 1:27 AM
Albin Varghese
Albin Varghese - avatar
5 Réponses
+ 11
In what language?
15th Nov 2017, 1:32 AM
qwerty
qwerty - avatar
+ 3
python: Res=1 for i in range(2,int(input()+1): Res*=i print(Res)
15th Nov 2017, 1:34 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
C++: int res; cin>>int a; for (int m=2;m<=a;m++){res*=m;} cout<<res;
15th Nov 2017, 1:35 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Admittedly, I don't think this is counted as a for loop, but... https://code.sololearn.com/csN157fHrwIU/?ref=app #Python
15th Nov 2017, 1:55 AM
blackcat1111
blackcat1111 - avatar
17th Nov 2017, 9:26 AM
#RahulVerma
#RahulVerma - avatar