https://code.sololearn.com/cO1AxhohECU5/?ref=app
1/18/2021 2:37:19 PM
Ira Sarkar7 Answers
New Answerprintf("Enter the five digit number: \n"); scanf("%d", &n); while(n>0){ int rem=n%10; revnum=revnum*10 + rem; n=n/10; } printf("The reversed number is: "); printf("%d",revnum); return 0;
Ira Sarkar you didn't told us that you have to solve it without loop. hopefully you got the answer tho.
Ira Sarkar now that you have solved it with inline code, you might enjoy seeing another approach. Here is a way to use recursion to print the number from right to left without using a loop: https://code.sololearn.com/ccK0p8BIKAaS/?ref=app
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message