Tuesday, March 7, 2017

EXAMPLE: PRINT REVERSE ORDER OF A NUMBER WITH C


EXAMPLE: PRINT REVERSE ORDER OF                           NUMBERS WITH C






#include<stdio.h>
#include<conio.h>
int reverse(int);
int main()
{
  int num;
  
  printf("enter a num:");
  scanf("%d",&num);
  reverse(num);
  getch();
}
int reverse(int a)
{
    int re;
     re=0;
     while(a!=0)
     {
     re=re*10;
     re=re+a%10;
     a=a /10;
     }
     printf("reverse = %d",re);
     }

No comments:

Post a Comment