+ 1

C++program using while loop to display the reverse of the input number.

11th Apr 2017, 2:19 AM
Tehreem
2 Respuestas
+ 1
Providing only the snippet: int n=input; int rn=0; while(n>0) { rn=(rn*10)+(n%10); n=n/10; } cout<<rn;
12th Apr 2017, 10:33 AM
Sayantan Saha
Sayantan Saha - avatar
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
14th Apr 2017, 6:01 PM
Arun Kumar
Arun Kumar - avatar