program to reverse the number in c-programming.
In this program, we will reverse the number by taking the input from the user .
If the number is entered by the user is 234 then the revere of the number is 432.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,rev=0;
printf("enter the number\n");
scanf("%d",&x);
while(x!=0){
y=x%10;
rev=10*rev+y;
x=x/10;
}
printf("the reverse of the number is %d",rev);
getch();
}
output:
enter the number 457
the reverse of the number is 754
Good brother
ReplyDelete