Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int a, b;
- void sokr(int a, int b, int step)
- {
- int ost0 = a % step;
- int ost1 = b % step;
- if (!ost0 && !ost1)
- sokr(a / step, b / step, 2);
- else if ((ost0 != 0) || (ost1 != 0))
- {
- if ((a > step) && (b > step))
- sokr(a, b, step+1);
- }
- printf("%d/%d\n", a, b);
- exit(0);
- }
- int main(int argc, char *argv[])
- {
- scanf("%d %d", &a, &b);
- int c = (a > b) ? a : b;
- sokr(6 - c + 1, 6, 2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement