WAP to reverse a number. | Sololearn: Learn to code for FREE!


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);

1/7/2018 2:45:47 PM

Vandanaa Vashisht

2 Answers

New Answer


It's ok for 3 digit numbers. Why don't you post this in the code playground instead?


You can just use StringBuilder to reverse string as it shows in the following code: https://code.sololearn.com/cJfcXRoys18W/?ref=app