An Algorithm to print the reverse digits of the given number using while loop.

1) START

2) Enter any natural number as Gno

3) Assign Revno=0

4) Check is (Gno>0) if TRUE then continue ELSE Goto Step 9

5) Calculate remainder as  rem=gno%10.

6) Assign Revno = Revno *10 + rem.

7) Assign Gno= Gno/10

8) GOTO Step 4

9) Print Value of Revno

10) END

Flowchart to print the reverse digits of the given number.

Flowchart to the reverse digits of the given number.
Flowchart to the reverse digits of the given number.

C program to print the reverse digits of the given number using while loop.

#include<stdio.h>
void main()
{
long int gno,rem,revno=0;
printf("Enter Any Number to reverse :");
scanf("%ld",&gno);
while(gno>0)    //loop condition
            {
            rem=gno%10;
            revno=revno *10+rem;
            gno=gno/10;
            }
printf("The reverse number is %ld",revno);
}

An algorithm to print the reverse digits of the given number using do….while loop.

1) START

2) Enter any natural number as Gno

3) Assign Revno=0

4) Calculate remainder as  rem=gno%10.

5) Assign Revno = Revno *10 + rem.

6) Assign Gno= Gno/10.

7) Check is (Gno>0) if TRUE then GOTO Step 4.

8) Print Value of Revno

9) END

Flowchart to print the reverse digits of the given number using do….while loop.

Flowchart to the reverse digits of the given number do......while
Flowchart to the reverse digits of the given number do……while

C-Code to print the reverse digits of the given number using do….while loop.

#include<stdio.h>
void main()
{
long int gno,rem;
printf("Enter Any Number to reverse :");
scanf("%ld",&gno);
do
            {
            rem=gno%10;
            printf("%ld",rem);
            gno=gno/10;
            }while(gno>0);  //loop condition
}

C-Code to print the reverse digits of the given number using for loop.

#include<stdio.h>
void main()
{
long int i,gno,rem;
printf("Enter any number :");
scanf("%ld",&gno);
for(i=gno;i>0;i=i/10)
   {
     rem=i%10;
     printf("%ld",rem);
   }
}