Computer Science, asked by nehakhatun1, 1 year ago

write a program to display all prime palindrome number between 10 and thousand​

Answers

Answered by BrainlySteveJobs
2

It is easy to write a program in Java for this. So, I am writing this program in Java Programming Language:

public class Main{

    public static void main(String[] args) {

          for(int i = 10 ; i < 1000 ; i++){

                int reversed = 0;

                int num = i;

                while(num != 0) {

                      int digit = num % 10;

                      reversed = reversed * 10 + digit;

                      num /= 10;

                }if(i == reversed){

                      boolean flag = false;

                      for(int j = 2; j <= i/2; ++j){

                            if(i % j == 0){

                                  flag = true;

                                  break;

                            }

                      }if(!flag){

                            System.out.print(i+",");

                      }

                }

          }

    }

}

Output of the program:

11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929

What is a Palindrome number ?

A Palindrome number is a number or text which is written in the backward as forward. In short, Numbers which are same from Backward and forward.

Eg: Racecar - In this word, The word starts from "RAC". And, If we read this number from Backward to forward, then it is also "RAC".

No. Eg: 10801 - In this number, The forward starts from number "10" and it's backward's forward is also "10".

Similar questions