What is wrong with this factorial code in c language? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

What is wrong with this factorial code in c language?

I was trying coding factorial problem in c using functions. I don't get this https://code.sololearn.com/cZRCs2gI7lxY/?ref=app

15th Nov 2021, 3:36 AM
Larson Sequeira
Larson Sequeira - avatar
2 Réponses
0
You didn't declare fact declare some value to fact before multiplying it. here for factorial use fact=1; int i=1; int fact=1; while (i<=num) { fact=fact*i; i++; } return fact;
15th Nov 2021, 3:42 AM
Arun Ruban SJ
Arun Ruban SJ - avatar
0
Thankyou I made a silly mistake hehe
15th Nov 2021, 7:47 AM
Larson Sequeira
Larson Sequeira - avatar