fork download
  1. #include <stdio.h>
  2. int kaijo(int n){
  3. int x=1,i;
  4. for(i=1;i<=n;i++){
  5. x=x*i;
  6. }
  7. return x;
  8. }
  9. int func(int n){
  10. if(n==1)
  11. return 1;
  12. else
  13. return kaijo(n)-func(n-1);
  14. }
  15. int main(void) {
  16. // your code goes here
  17. int n=4;
  18. printf("%d",func(n));
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
19