WAP TO REVERSE OF ANY NUMBER USING WHILE LOOP

Thursday, July 2, 2009 Leave a Comment

 

#include<stdio.h>
#include<conio.h>
void main ()
{
int no,a,res;
clrscr ();
printf ("Enter any value: ");
scanf ("%d",&no);
a=res=0;
while (no>0)
{
a=no%10;
no=no/10;
res=(res*10)+a;
}
printf ("\nReverse is %d",res);
getch ();
}

OUTPUT
Enter any value: 315
Reverse is 513

Related Posts :



0 comments »

Leave your response!