Reverse a Number (While Loop)

 #include<stdio.h>

int main()

{

    int n,rev=0,rem;


    printf("Enter number: ");

    scanf("%d",&n);


    while(n!=0)

    {

        rem=n%10;

        rev=rev*10+rem;

        n=n/10;

    }


    printf("Reverse = %d",rev);


}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices