Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  pallindrome
Language: JAVA
Code:
import java.util.Scanner;
public class Pallindrome{

     public static void main(String []args)
     {
        int x=0;
        Scanner sc=new Scanner (System.in);
        System.out.println("ENTER THE UPPER LIMIT");
        x=sc.nextInt();
        int z=2;
      
        while(z<x)
        {   int  y=0;
            int reverse=0;
            z=z+1;
            for(int i=2;i<z;i++)
            {  
                if(z%i==0)
                break;
                else
               {
                 y=y+1;
               }
                
            }
            if (y==z)
            {
            while(y!=0)
            {
               
                reverse=reverse*10;;
                reverse=reverse+(y%10);
                y=y/10;
            }
            if(z==reverse)
            {
        System.out.println("mirrored prime number is"+z);
            }
            }
            
        }
        
        
     }
}
Comments: