#include <stdio.h>

int main() {
       
  int n;
  printf("enter an integer\n");
    int fact = 1;
    int i = 1;
  if(scanf("%d", &n) != 1) {
      printf("error");
    } else if(n < 0) {
        printf("invalid");
    } else {
  while(i <= n) {
      fact *= i;
      i++;
  }
      printf("%d\n", fact);
    }
  
  
      
    //return 
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: