Java Program to Print Palindrome Number in a Given Range
Python Program
to Print Palindrome Number Between Two Number
Example: Code Program
import java.util.*;
public class Palindrome {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int start, end,num, rem,rev, temp;
System.out.print("Enter Starting Number:");
start = sc.nextInt();
System.out.print("Enter Ending Number:");
end = sc.nextInt();
for(num = start; num<=end; num++) {
temp = num;
rev = 0;
while(temp>0) {
rem = (int)temp%10;
temp= (int)temp/10;
rev = rev*10+rem;
}
if(num == rev)
System.out.print(rev+"\t");
}
}
}
Output:
Python Program
Post a Comment