C Programming Tutorial

 
 
 
 

Image

#include <stdio.h>
#include <conio.h>

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);
     }
     }
}