#include<stdio.h> #include<conio.h> void main() { int num,rem,rev=0; clrscr(); printf("Enter any no to be reversed : "); scanf("%d",&num); while(num>=1) { rem = num % 10; rev = rev * 10 + rem; num = num / 10; } printf("Reversed Number : %d",rev); getch(); }
Output :
Enter any no to be reversed : 123 Reversed Number : 321
No comments:
Post a Comment