/*
Q.    Write a C program to reverse a number using do-while loop.
*/

#include<stdio.h>

main()
{
    int i,j,n,rev=0;
    printf("\nEnter a number=");
    scanf("%d",&n);
   
    do
    {
        rev=rev*10+n%10;
        n=n/10;
    }while(n!=0);
    printf("\nThe reverse number=",rev);
}

No comments:

Post a Comment