Friday, June 26, 2020

Reverse of the Number

C Program to Reverse a Number

PROGRAM:

#include<stdio.h>
int main() 
{
    int a,b,r=0;
    scanf("%d",&a);
    while(a>0)
    {
        b=a%10;
        r=r*10+b;
        a=a/10;
    }
    printf("Reverse of the number is %d",r);
    return 0;
}
OUTPUT:
234                                                                                                                     
Reverse of the number is 432  

No comments:

Post a Comment