+ 2
How to reverse 321 to 123 using while loop ?
3 Réponses
+ 3
int n,digit,rev=0;
//i think u know what will be the process after
while(n!=0)// till the n is zero
{
digit=n%10;
rev=rev*10+digit;
n=n/10;
}
so print the reverse number
S.o.p("reversed number is "+rev);
+ 1
https://code.sololearn.com/cXvXvMXQUWy2/?ref=app
Check it out
0
use palindrome