+ 2
Java question input123456 output456123
Example is like input the integer123456 the program will output 456123 or input 12345 the program will output 45312. Is anyone could help me how to do this?
2 Answers
+ 11
convert number to String & then use substring ... will be over in 1 line
//make code yourself , if error will come ... i'll correct âș
+ 5
This code will grab a digit to be stored and remove it from the original.
int num = 123;
int digit = num%10; // 3
num /= 10; // 12
Store the digits. Figure out the starting digit. Use this code to put them back together.
int digit = 1;
int result = 23;
result *= 10; // 230
result += digit; // 231