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 Antworten
+ 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