Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- int test;
- BigInteger bi, bi1, bi2, val, val1;
- Scanner sc = new Scanner(System.in);
- test = sc.nextInt();
- while (test > 0) {
- bi = sc.nextBigInteger();
- char ch = sc.next().charAt(0);
- bi1 = sc.nextBigInteger();
- bi2 = bi.gcd(bi1);
- val = bi.divide(bi2);
- val1 = bi1.divide(bi2);
- System.out.println("" + val + " / " + val1);
- test--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment