Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fakt(int x) {
- if(x == 1) {
- return 1;
- }
- return x * fakt(x - 1);
- }
- int main()
- {
- int A, B;
- scanf("%d%d", &A, &B);
- for(int i = A; i <= B; i++) {
- if(fakt(i) > 100) {
- printf("%d ", i);
- }
- }
- return 0;
- }
- /*
- fakt(5) = 5 * fakt(4) = 5 * 24 = 120
- fakt(4) = 4 * fakt(3) = 4 * 6 = 24
- fakt(3) = 3 * fakt(2) = 3 * 2 = 6
- fakt(2) = 2 * fakt(1) = 2 * 1 = 2
- fakt(1) = 1
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement