Reverse of a number Program in C

Reverse of a number Program in C
Reverse of a number Program in C

WAP to find the reverse of a number.

#include<stdio.h>
void main()
{
	int n,r,rev=0;
	printf("Enter number=");	
	scanf("%d",&n);
	while(n>0)
	{
		r=n%10;
		rev=rev*10+r;
		n=n/10;	
	}
	printf("Reverse number=%d",rev);		
}

Output:

Enter number=1234
Reverse number=4321
b. tech. bca c language tutorial learn c language study c language
Recent Posts