#include <stdio.h>int main(void){ int i,n; long p=1; printf("Please enter n:"); scanf("%d", &n); for (i=1; i<=n; i++) {p=i*p; printf("%d! = %ld\n", i,p); } return 0;}
10
Please enter n:1! = 1 2! = 2 3! = 6 4! = 24 5! = 120 6! = 720 7! = 5040 8! = 40320 9! = 362880 10! = 3628800
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!