Advertisement
Farjana_akter

Untitled

Aug 4th, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. /*package whatever //do not write package name here */
  2.  
  3. import java.io.*;
  4. import java.math.BigInteger;
  5. import java.util.Scanner;
  6.  
  7. class Main {
  8. public static void main (String[] args) {
  9. Scanner input=new Scanner(System.in);
  10. int tst=input.nextInt();
  11. while(tst>0)
  12. {
  13. BigInteger p=new BigInteger(input.next());
  14. String s=input.next();
  15. BigInteger q=new BigInteger(input.next());
  16. BigInteger g=p.gcd(q);
  17. System.out.println(p.divide(g)+" / "+q.divide(g));
  18. tst--;
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement