Find the reverse of a number in C language

 WAP to find the reverse of a number.


#include<stdio.h>

#include<conio.h>

void main()

{

  int num,i,rem,temp,s=0;

  clrscr();

  printf("\n Enter any number :");

  scanf("%d",&num);

  temp=num;

  while(num>0)

  {

   rem=num%10;

   s=s*10+rem;

   num=num/10;

  }

  printf("\n Reverse of %d is %d",temp,s);

  getch();

}

Output:-

Enter any number

1524

Reverse of 1524 is 4251

Post a Comment

0 Comments