fork download
  1. #include <stdio.h>
  2. int kaijo (int x){
  3. if(x==1 || x==0){
  4. return x;
  5. }else{
  6. x=x*kaijo(x-1);
  7. return x;
  8. }
  9. }
  10.  
  11. int main(){
  12. for (int i=1;i<=10;i++){
  13. printf("%d!%d\n",i,kaijo(i));
  14. }
  15. return 0;
  16.  
  17. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1!1
2!2
3!6
4!24
5!120
6!720
7!5040
8!40320
9!362880
10!3628800