Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdbool.h>
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include <ctype.h>
- struct phanSo {
- int tu, mau;
- };
- void main()
- {
- phanSo so[200];
- int n;
- scanf("%d", &n);
- for (int i = 0; i < n; i++)
- {
- //printf("type next\n");
- scanf("%d %d", &so[i].tu, &so[i].mau);
- }
- for (int i = 0; i < n; i++)
- {
- if (so[i].tu % so[i].mau == 0)
- printf("%d ", so[i].tu / so[i].mau);
- else
- {
- if (so[i].mau % so[i].tu == 0)
- {
- int per = so[i].mau / so[i].tu;
- printf("%d/%d ", (so[i].tu/per) , so[i].mau/per);
- }
- else
- printf("%d/%d ", so[i].tu, so[i].mau);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement