0

WAP to reverse a number.

int n, n1, n2, r; n-Integer.parseInt(text1.getText()); n1-n%10; n-n/10; n2-n%10; n-n/10; r-(n1*100)+(n2*10)+n; text2.setText(""+r);

7th Jan 2018, 2:45 PM
Vandanaa Vashisht
Vandanaa Vashisht - avatar
2 Answers
+ 1
It's ok for 3 digit numbers. Why don't you post this in the code playground instead?
7th Jan 2018, 3:45 PM
Dan Walker
Dan Walker - avatar
0
You can just use StringBuilder to reverse string as it shows in the following code: https://code.sololearn.com/cJfcXRoys18W/?ref=app
7th Jan 2018, 3:44 PM
Alex Chermenin
Alex Chermenin - avatar