write a program to print the no 20 to 10 in reverse order in while loop
Answers
Answered by
0
Answer:
#include <stdio.h>
int main() {
int n, rev = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0) {
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
printf("Reversed number = %d", rev);
return 0;
}
Output
Enter an integer: 2345
Reversed number = 5432
Answered by
1
Answer:
In this example, you will learn to reverse the number entered by the user. ... main() { int n, rev = 0, remainder; printf("Enter an integer: "); scanf("%d", &n); while (n != ... rev * 10 + remainder; n /= 10; } printf("Reversed number = %d", rev); return 0; }. Output ... In each iteration of the loop.
Explanation:
PLZ SIS
MARK AS BRAINLIST
Similar questions