Thursday, February 2, 2012

REVERSE A NUMBER


#include<stdio.h>
#include<conio.h>

void main()
{
  int num,sum=0,r;
  clrscr();
  printf("\nEnter a number:");
  scanf("%d",&num);
  while(num)
  {
            r=num%10;
            sum=sum*10+r;
            num=num/10;
  }
   printf("\nReverse number=%d",sum);
  getch();
}

No comments:

Post a Comment