+ 1
C++program using while loop to display the reverse of the input number.
2 Respostas
+ 1
Providing only the snippet:
int n=input;
int rn=0;
while(n>0)
{
rn=(rn*10)+(n%10);
n=n/10;
}
cout<<rn;
0
while(number != 0){
rightDigit = number % 10;
reverse = (reverse * 10) + rightDigit;
number = number/10;
}
printf("Reversed number : %d\n", reverse);
Source :
http://www.techcrashcourse.com/2014/10/c-program-reverse-number.html
http://www.techcrashcourse.com/2016/04/cpp-program-to-reverse-digits-of-number.html