Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int n = 0;
  6. int res = 1;
  7.  
  8.  
  9. printf("n:");
  10. scanf("%i",&n);
  11.  
  12.  
  13. if(n % 2 == 0)
  14. {
  15. while(n > 0)
  16. {
  17. res = res * n;
  18. n = n - 2;
  19. }
  20. }
  21. else
  22. {
  23. while(n > 0)
  24. {
  25. res = res * n;
  26. n = n - 2;
  27. }
  28. }
  29.  
  30.  
  31. printf("res = %i",res);
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement