2

palindromes

Free lines C/C++ 1 revisions 179 a year ago a year ago
#include<stdio.h>

int main()
{
   	int num, rem, reverse_num, temp, start, end;

   	printf("Enter the lower limit: ");
   	scanf("%d",&start);

   	printf("Enter the upper limit: ");
   	scanf("%d",&end);

   	printf("Palindrome numbers between %d and %d are: ",start,end);
   	for(num=start;num<=end;num++)
   	{
      	temp=num;
      	reverse_num=0;
      	while(temp)
      	{
         	rem=temp%10;
         	temp=temp/10;
         	reverse_num=reverse_num*10+rem;
      	}
      	if(num==reverse_num)
        	printf("%d ",num);
    }
}

takes input for minimum integer & maximum integer & finds all the integers inbetween.