Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int numbers_game(int min, int max)
- {
- int counter, c = min;
- if (max - min == 1) return min * max;
- if (min == 1)
- {
- min = 1;
- counter = 1;
- while (min != max)
- {
- min += 1;
- if (counter % min != 0)
- {
- if (min % 2 == 0) counter *= 2;
- else if (min % 3 == 0) counter *= 3;
- else counter *= min;
- }
- }
- return counter;
- }
- else
- {
- counter = max;
- while (1)
- {
- min = c;
- while (min != max + 1)
- {
- if (counter % min != 0) break;
- if (min == max ) return counter;
- min += 1;
- }
- counter += max;
- }
- }
- }
- int main(void)
- {
- int min, max;
- scanf("%d%d", &min, &max);
- printf("%d", numbers_game(min, max));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement