/* Program to find a reverse of a number */
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,c,n,rev;
printf("\n Enter the value of n ");
scanf("%d",&n);
a=n%10;
b=(n/10)%10;
c=(n/10)/10;
rev=a*100+b*10+c*1;
printf("\n The reverse of a given number is %d",rev);
getch();
}
Output
Enter the value of n
123
The reverse of a given number is321
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,c,n,rev;
printf("\n Enter the value of n ");
scanf("%d",&n);
a=n%10;
b=(n/10)%10;
c=(n/10)/10;
rev=a*100+b*10+c*1;
printf("\n The reverse of a given number is %d",rev);
getch();
}
Output
Enter the value of n
123
The reverse of a given number is321
The output will be seen as shown below:
No comments:
Post a Comment