fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n;
  5. printf("Enter the number: ");
  6. scanf("%d",&n);
  7. int factorial=1;
  8. for(int i=1;i<=n;i++){
  9. factorial=factorial*i;
  10.  
  11. printf("%d\n",factorial);
  12. }
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5320KB
stdin
5
stdout
Enter the number: 1
2
6
24
120