#include<conio.h>
#include<stdio.h>
void main()
{
int number,rem;
int reverse=0;
printf("Enter an integer number: ");
scanf("%d", &number);
while(number!=0)
{
rem=number%10;
reverse=reverse*10+rem;
number=number/10;
}
printf("Reversed Number = %d",reverse);
getch();
}
OUTPUT:
Enter an integer number: 123
Reversed Number = 321
#include<stdio.h>
void main()
{
int number,rem;
int reverse=0;
printf("Enter an integer number: ");
scanf("%d", &number);
while(number!=0)
{
rem=number%10;
reverse=reverse*10+rem;
number=number/10;
}
printf("Reversed Number = %d",reverse);
getch();
}
OUTPUT:
Enter an integer number: 123
Reversed Number = 321
No comments:
Post a Comment