Advertisement
Farjana_akter

Untitled

Aug 4th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import java.io.*;
  2. import java.math.BigInteger;
  3. import java.util.Scanner;
  4. class Main {
  5. public static void main (String[] args) {
  6. Scanner input=new Scanner(System.in);
  7. while(true)
  8. {
  9. int base=input.nextInt();
  10. if(base==0)
  11. break;
  12. BigInteger p=new BigInteger(input.next(),base);
  13. BigInteger m=new BigInteger(input.next(),base);
  14. System.out.println((p.mod(m)).toString(base));
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement