import java.util.*;
public class Ch2Q23
{
public static void main(String[] args)
{Scanner kbd = new Scanner(System.in);
int no;
System.out.print("Enter the integer: ");
no = kbd.nextInt();
int dig, rev = 0, count = 0;
while(no != 0)
{dig = no % 10;
rev = rev* 10 + dig;
no = no/10;
}
no = rev;
for(int i = 1; i<= 4; i++)
{dig = no % 10;
System.out.print(dig+" ");
no = no/10;
}
}
}
No comments:
Post a Comment