You are given a 6 digit number n , you have to pick the last 2 digits of the number of and put them in the starting. Your task is to write a Program for the above problem and Print the Transformed number.
Input Format
For each test case, you will be given a number n as an integer input.
Constraints
Given n should be 6 digits Number .
Output Format
Print the transformed number.
Sample Input 0
123456
Sample Output 0
561234
Explanation 0
123456 is given, then this number should transform to 561234.
ALSO READ: Check Palindrome
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int temp=n;
int count=0;
while(temp>0){
count++;
temp/=10;
}
int reverseNumber=0;
int op=2;
count-=2;
int num=1;
while(count>0){
num*=10;
count--;
}
while(op>0){
int lastdigit=n%10;
reverseNumber=reverseNumber*10+lastdigit;
op--;
n/=10;
}
int reverse=0;
while(reverseNumber>0){
int k=reverseNumber%10;
reverse=reverse*10+k;
reverseNumber/=10;
}
reverse*=num;
reverse+=n;
System.out.println(reverse);
}
}