Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*package whatever //do not write package name here */
- import java.io.*;
- import java.math.BigInteger;
- import java.util.Scanner;
- class Main {
- public static void main (String[] args) {
- Scanner input=new Scanner(System.in);
- int tst=input.nextInt();
- while(tst>0)
- {
- BigInteger p=new BigInteger(input.next());
- String s=input.next();
- BigInteger q=new BigInteger(input.next());
- BigInteger g=p.gcd(q);
- System.out.println(p.divide(g)+" / "+q.divide(g));
- tst--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement