Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdbool.h>
  3. #include <stdio.h>
  4. #include <math.h>
  5. #include <string.h>
  6. #include <ctype.h>
  7.  
  8. struct phanSo {
  9. int tu, mau;
  10. };
  11. void main()
  12. {
  13. phanSo so[200];
  14. int n;
  15. scanf("%d", &n);
  16. for (int i = 0; i < n; i++)
  17. {
  18. //printf("type next\n");
  19. scanf("%d %d", &so[i].tu, &so[i].mau);
  20. }
  21.  
  22. for (int i = 0; i < n; i++)
  23. {
  24. if (so[i].tu % so[i].mau == 0)
  25. printf("%d ", so[i].tu / so[i].mau);
  26. else
  27. {
  28. if (so[i].mau % so[i].tu == 0)
  29. {
  30. int per = so[i].mau / so[i].tu;
  31. printf("%d/%d ", (so[i].tu/per) , so[i].mau/per);
  32. }
  33. else
  34. printf("%d/%d ", so[i].tu, so[i].mau);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement