Fortunately this program works fine to find the factorials of 1 to 12 but after 12 as 13, 14, 20 ..... output getting wrong and i also try to find the factorial of 40 and the output was 0. Failed to find the exact problem...
#include <stdio.h>
int main() {
int user_input, tbl;
printf("Enter any number: \t");
scanf("%i", &user_input);
tbl = user_input;
for(int i=2; i < user_input; i++) {
tbl = tbl * i;
}
printf("Factorial of %i is %i", user_input, tbl);
}