Write a program for reverse number.

Write a program for reverse number.

 

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int n1,n,rem,rev=0;

printf("enter a number=");

scanf("%d",&n);

n1=n;

while(n!=0)

{

rem=n%10;

rev=rev*10+rem;

n=n/10;

}

 

printf("reverse of %d is %d",n1,rev);

getch();

}

 

=================================================

 

Output:

 

Enter a number=234

Reverse of 234 is 432

 


Comments