fork download
  1. #include <stdio.h>
  2. int fact(int n){
  3. int result =1;
  4. while(n>1){
  5. result *=n;
  6. n--;
  7. }
  8. return result;
  9. }
  10.  
  11. int main(void) {
  12. int n;
  13. scanf("%d",&n);
  14. printf("%d",fact(n));
  15. // your code goes here
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5320KB
stdin
6
stdout
720