Write a prog to find and print first N positive integers whose squares are palindormes.

*/
/*Write a prog to find and print first N positive integers whose
squares are palindormes.
eg: 11^2 = 121, 26^2 = 676.
*/



/**************************************************************/
/*Programmed by : Vivek Patel**********************************/
/*For Bugs Free feel to contact********************************/
/*Website : www.vivekpatel.cjb.net*****************************/
/*Email : vivek_patel9@rediffmail.com**************************/
/**************************************************************/

#include
#include

void main(){
int n;
void pelind(int);
clrscr();
printf("Enter Value of N : ");
scanf("%d",&n);
pelind(n);
getch();
}

void pelind(int n){
int cnt=0,i,rev,rem,tmpnum,c;
printf("\n\n****N Pelindrome Squares are *****\n");
for(i=1;cnt!=n;i++){
//square
c=i*i;
tmpnum=c;
rev=0;
while(c>0){
rem=c%10;
rev=rev*10+rem;
c=c/10;
}
if(tmpnum==rev)
{
cnt++;
printf("N is %d --> Pelindrome square is %d\n",i,tmpnum);
}
}
}



Powered by Wufoo