Hello, I am very new to C, I was making an experiment after reading the C tutorial on the site up until the "Loops" section. I've made a program which I can compile but which doesn't return any result. The code is as follows:
Code:
#include <stdio.h>
int main(){
int num1;
int fact = 1;
int x;
printf ("Insert the number whose factorial you want to know: \n");
scanf ("%d", &num1);
for ( x=1; x <= num1; x++ ){
fact = fact*x;
scanf("%d", &fact);
}
printf ("The factorial of %d is %d \n", num1, fact );
return(0);
}
I'd appreciate if someone could have a look at it and possibly tell me what I'm doing wrong?
Thank you very much in advance!