java - Multiple inputs and getting output at once -


i intend find number of palindromes inbetween given numbers, variable 't' decides number of test cases. example, if t=2 give input :

2 12 23(in next line) 56 78(in next line) output be: 1 2 (next line) 

but code after input given :

2 12 23  

i output 1 , should proceed give next test case

how can give both test cases once?

import java.io.*; import java.util.scanner; public class checkall {     public int check_all(int a, int b) {         int c = 0;         (int y = a; y <= b; y++) {             int z = y;             int d = 0;             while (z > 0) {                 d = d * 10 + z % 10;                 z /= 10;             }             if (d == y) c++;         }         return c;     }     public static void main(string args[]) throws ioexception {         bufferedreader br = new bufferedreader(new inputstreamreader(system. in ));         //system.out.println("enter limits");         int t = integer.parseint(br.readline());         (int s = 1; s <= t; s++) {             scanner scn;             scn = new scanner(system. in );             int = scn.nextint();             int b = scn.nextint();             checkall p = new checkall();             p.check_all(a, b);             system.out.print(p.check_all(a, b));         }     } } 

public static void main(string args[]) throws ioexception {     bufferedreader br = new bufferedreader(new inputstreamreader(system. in ));     //system.out.println("enter limits");     int t = integer.parseint(br.readline());     int[][] limits = new int[t][2];     // 1st read limits     (int s = 1; s <= t; s++) {         scanner scn;         scn = new scanner(system. in );         limits[s-1][0] = scn.nextint();         limits[s-1][1] = scn.nextint();     }     // 2nd process of them.     ( int s = 1; s <= t; s++ ) {         checkall p = new checkall();         p.check_all(limits[s-1][0], limits[s-1][1]);         system.out.print(p.check_all(limits[s-1][0], limits[s-1][1]));     } } 

Comments