Program to reverse a number using do-while loop.
#include <stdio.h>
#include <conio.h>
void main()
{
int i, b=0, a=0;
clrscr();
printf ("Enter a number: ");
scanf ("%d", &i);
printf ("The reverse is: ");
do
{
a = i%10;
b = i/10;
i = b;
printf ("%d", a);
}
while (i>0);
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int i, b=0, a=0;
clrscr();
printf ("Enter a number: ");
scanf ("%d", &i);
printf ("The reverse is: ");
do
{
a = i%10;
b = i/10;
i = b;
printf ("%d", a);
}
while (i>0);
getch();
}