fork download
  1. #include<stdio.h>
  2.  
  3. int calculafatorial(int num) {
  4. int fat = 1;
  5. while (num > 1) fat *= num--;
  6. return fat;
  7. }
  8.  
  9. int main(void) {
  10. int num;
  11. scanf("%d", &num);
  12. printf("%d", calculafatorial(num));
  13. }
  14.  
  15. //https://pt.stackoverflow.com/q/266565/101
Success #stdin #stdout 0s 5280KB
stdin
6
stdout
720