ALGORITHM
1.START.
2.INPUT THE NUMBER.
3.REVERSE THE NUMBER USING THE FORMULA REV=REV*10+REMAINDER.
4.PRINT THE REVERSE NUMBER.
5.END.
FLOWCHART
PROGRAM
#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 =n / 10;
}
printf("Reversed number = %d", rev);
return 0;
}
OUTPUT
Enter an integer: 12345
Reversed number = 54321
0 Comments