Skip to content

C program to print palindrome series up to inputted number

by yashan on February 6th, 2012

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

One Comment
  1. Ashish Tripathi permalink

    any program how to logic

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS