Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* package whatever; // don't place package name! */
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- /* Name of the class has to be "Main" only if the class is public. */
- class Ideone
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- // your code goes here
- //System.out.println("Hello");
- Scanner in = new Scanner(System.in);
- int n = in.nextInt();
- int no,count;
- int rev,num,a,b,c;
- for (int i=0;i<n;i++){
- num=in.nextInt();
- count = 0;
- rev=0;
- a=num;
- while (a != 0)
- {
- rev = rev*10 + a % 10;
- a /= 10;
- }
- //System.out.println(num);
- //System.out.println(rev);
- while (num!=rev){
- count++;
- num=num+rev;
- a=num;
- rev=0;
- while (a != 0)
- {
- rev = rev*10 + a % 10;
- a /= 10;
- }
- }
- System.out.println(count+" "+num);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement