/*Program to reverse an n-digit decimal integer & print wheather it's reverse is equal to it or not*/ /* AUTHOR : SHEKHAR */ main() { long int a,x,y,v,b,c,d,f,e=0,loop; clrscr(); loop=1; while(loop!=0) { clrscr(); printf("\n\t\t This program will help you to evaluate the reverse order of \n\t\t a given n-digit integer and print wheather it is equal to \n\t\t the original number or not.\n\n\t\tType 1 to continue and 0 to exit : "); scanf("%ld",&loop); switch(loop) { case 1 : printf("\n\n\n\t\t<><><><><><><><> S-T-A-R-T <><><><><><><><>"); printf("\n\n\t\t Enter any integer : "); scanf("%ld",&a); x=a; y=a; v=0; printf("\n\n\n\t\t=============== A N S W E R ==============="); printf("\n\t\t -----------"); printf("\n\n\t\t The reverse order of the entered integer is : "); while(a!=0) { b=a%10; printf("%ld",b); v++; a=a/10; } c=1; d=0; while(d<(v-1)) { c=c*10; d++; } f=0; while(x!=0) { b=x%10; e=b*c; f=f+e; x=x/10; c=c/10; } if(f==y) printf("\n\n\t\t The number is equal to it's reverse order.\n\n\n\n\t\tPress any key to continue........"); else printf("\n\n\t\t The number is not equal to it's reverse order.\n\n\n\n\t\tPress any key to continue........"); getch(); break; case 0 : printf("\n\n\n\n\t\t$$$$$$$$$$$$$$ PROGRAM TERMINATED $$$$$$$$$$$$$$\n\n\n\t\tPress any key to return to source file........"); getch(); break; default: printf("\n\n\n\n\t\t!!!!!!!!!!!!!!{}{} INVALID INPUT {}{}!!!!!!!!!!!!!!\n\n\n\t\tPress any key to continue........"); getch(); break; } } }