#include <stdio.h> int main() { int n, i; long long fact = 1; printf("Enter a positive integer: "); scanf("%d", &n); for(i = n; i >= 1; i--) { fact *= i; } printf("Factorial of %d is %lld\n", n, fact); return 0;}
Standard input is empty
#include <stdio.h> int main() { int n, i; long long fact = 1; printf("Enter a positive integer: "); scanf("%d", &n); for(i = n; i >= 1; i--) { fact *= i; } printf("Factorial of %d is %lld\n", n, fact); return 0; }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!