Friday, 19 September 2014

WAP to Reverse a given integer number

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int s,a,b,x;
printf("\n  Enter the no. to reverse ");
scanf("%d",&a);
s=0;
b=a;
while(b>0)
{
x=b%10;
s=s*10+x;
b=int(b/10);
}
printf("\n  Reverse : %d ",s);
getch();
}

No comments:

Post a Comment

Please write your doubts