C Program to reverse a given number

#include
void main()
{
 int a,b,c=0;
 printf("enter no\n");
 scanf("%d",&a);
 while(a!=0)
  {
   b=a%10;
   c=c*10+b;
   a=a/10;
  }
  printf("Reversed no. is %d\n",c);
}
Output:

C Program to reverse a given number C Program to reverse a given number Reviewed by Prashant Sengar on December 22, 2017 Rating: 5

No comments:

Powered by Blogger.