/*wap to find revrse of a given no.(using wile loop) & check whether the given no. is pelindrom or not*/ #include<stdio.h> #include<conio.h> void main() { int n,rev=0,a,m; clrscr(); printf("enter value of n:"); scanf("%d",&n); m=n; while(n!=0) { a=n%10; n=n/10; rev=rev*10+a; } printf("\nreverse number:%d",rev); if(rev==m) { printf("\nThe Number is Pelindrom"); } else { printf("\nThe Number is Not Pelindrom"); } getch(); }
No comments:
Post a Comment