fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. try
  11. {
  12. Scanner s=new Scanner(System.in);
  13. int t=s.nextInt();
  14. for(int i=0;i<t;i++)
  15. {
  16. int a=s.nextInt();
  17. int b=s.nextInt();
  18. System.out.println((a%b));
  19.  
  20. }
  21. }
  22. catch(Exception e)
  23. {
  24. return ;
  25. }
  26.  
  27. }
  28. }
Success #stdin #stdout 0.14s 56656KB
stdin
3 
1 2
100 200
40 15
stdout
1
100
10