Advertisement
Josif_tepe

Untitled

Nov 18th, 2021
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int fakt(int x) {
  4.     if(x == 1) {
  5.         return 1;
  6.     }
  7.     return x * fakt(x - 1);
  8. }
  9. int main()
  10. {
  11.     int A, B;
  12.     scanf("%d%d", &A, &B);
  13.     for(int i = A; i <= B; i++) {
  14.         if(fakt(i) > 100) {
  15.             printf("%d ", i);
  16.         }
  17.     }
  18.     return 0;
  19. }
  20.  
  21. /*
  22.  fakt(5) = 5 * fakt(4) = 5 * 24 = 120
  23.  fakt(4) = 4 * fakt(3) = 4 * 6 = 24
  24.  fakt(3) = 3 * fakt(2) = 3 * 2 = 6
  25.  fakt(2) = 2 * fakt(1) = 2 * 1 = 2
  26.  fakt(1) = 1
  27.  
  28.  
  29.  */
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement