# Find out all palindrome numbers present within a given range.

Write a C program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range in C.

Program in C

Code:

/*Write a C program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range Using C*/

#include<stdio.h>
int main()
{
int range1,range2,i;
printf("Enter a range in numbers(num1-num2):");
scanf("%d %d",&range1,&range2);
int num1=0;
int num2=0;
printf("%d to %d palindrome numbers are \n",range1,range2);
for(i=range1;i<=range2;i++)
{
num1=i;
num2=0;
while(num1!=0)
{
int rem=num1%10;
num1/=10;
num2=num2*10+rem;
}
if(i==num2)
printf("%d ",i);
}
}

Input/Output:
Enter a range in numbers(num1-num2):
121
300
121 to 300 palindrome numbers are
121 131 141 151 161 171 181 191 202 212 222 232 242 252 262 272 282 292

Write a C++ program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range in C++.

Program in C++

Code:

/*Write a C++ program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range using C++*/

#include<iostream>
using namespace std;
int main()
{
int range1,range2;
cout<<"Enter a range in numbers(num1-num2):";
cin>>range1>>range2;
int num1=0;
int num2=0;
cout<<range1<<" to "<<range2<<" palindrome numbers are "<<"\n";
for(int i=range1;i<=range2;i++)
{
num1=i;
num2=0;
while(num1!=0)
{
int rem=num1%10;
num1/=10;
num2=num2*10+rem;
}
if(i==num2)
cout<<i<<" ";
}
}

Input/Output:
Enter a range in numbers(num1-num2):
7777
9999
7777 to 9999 palindrome numbers are
7777 7887 7997 8008 8118 8228 8338 8448 8558 8668 8778 8888 8998 9009 9119 9229 9339 9449 9559 9669 9779 9889 9999

Write a JAVA program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range in Java.

Program in Java

Code:

/*Write a JAVA program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range using Java*/

import java.util.Scanner;

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int range1,range2;
System.out.println("Enter a range in numbers(num1-num2):");
range1=sc.nextInt();
range2=sc.nextInt();
int num1=0;
int num2=0;
System.out.println(range1+" to "+range2+" palindrome numbers are");
for(int i=range1;i<=range2;i++)
{
num1=i;
num2=0;
while(num1!=0)
{
int rem=num1%10;
num1/=10;
num2=num2*10+rem;
}

if(i==num2)
System.out.print(i+" ");
}
sc.close();
}
}

Input/Output:
Enter a range in numbers(num1-num2):
7894
9000
7894 to 9000 palindrome numbers are
7997 8008 8118 8228 8338 8448 8558 8668 8778 8888 8998

Write a PYTHON to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range in Python.

Program in Python

Code:

'''Write a Python program to find out all palindrome numbers present within a given range. or Write a program to find out all palindrome numbers present within a given range using Python '''

print("Enter a range in numbers(num1-num2):")
range1=int(input())
range2=int(input())
print(range1," to ",range2," palindrome numbers are ");
for i in range(range1,range2+1):
num1=i
num2=0
while(num1!=0):
rem=num1%10
num1=int(num1/10)
num2=num2*10+rem
if(i==num2):
print(i,end=" ")

Input/Output:
Enter a range in numbers(num1-num2):
1000
2000
1000  to  2000  palindrome numbers are
1001 1111 1221 1331 1441 1551 1661 1771 1881 1991

1. 2. 