Plz give me the reason why this is not giving correct output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Plz give me the reason why this is not giving correct output

#include <stdio.h> int main() { int i=1,num,fact=1; printf("Enter the number to find its factorial"); scanf("%d",&num); { for(i=1;i<=num;i++) fact=fact*i; printf("Factorial : %d",num); } return 0; }

11th Jan 2024, 3:09 PM
Manoj Sonpethkar
Manoj Sonpethkar - avatar
2 Answers
+ 6
you print out "num" instead of "fact"
11th Jan 2024, 3:11 PM
Lisa
Lisa - avatar
+ 1
Manoj Sonpethkar , Please add a tag for the language.
12th Jan 2024, 7:57 AM
Rain
Rain - avatar