C program to print palindrome series up to inputted number

Below is the C program in the C programming language to print the palindrome series up the inputted number –

/* C program to print the palindrome series upto the inputted limit */
#include<stdio.h>
void main()
{
     int limit,i2,n2,n3=0,i;
     
     printf("Enter limit to print all palindrome no. upto that limit \n");
     scanf("%d",&limit);
     
     for(i=1;i<=limit;i++)
     {
           i2=i;
           do
           {
                 n2=i2%10;
                 i2=i2/10;
                 n3=n3*10+n2;
           }
           while(i2>0);
           
           if(n3==i)
           {
               printf("%d \t",n3);
           }
           n3=0;
     }
     getch();
}

yashan has written 69 articles

2 thoughts on “C program to print palindrome series up to inputted number

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>