// Program
#include<stdio.h>
void main()
{
int a,b,n;
clrscr();
printf("Enter any number:");
scanf("%d",&n);
b=0;
while(n!=0)
{
a=n%10;
b=(b*10)+a;
n=n/10;
}
printf("Reverse of a number=%d",b);
getch();
}
Sample Input/Output:
Enter any number:1234
Reverse of a number=4321
#include<stdio.h>
void main()
{
int a,b,n;
clrscr();
printf("Enter any number:");
scanf("%d",&n);
b=0;
while(n!=0)
{
a=n%10;
b=(b*10)+a;
n=n/10;
}
printf("Reverse of a number=%d",b);
getch();
}
Sample Input/Output:
Enter any number:1234
Reverse of a number=4321
No comments:
Post a Comment