File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import java .io .*;
2+ import java .util .*;
3+ public class PrimePal
4+ {
5+ public static void main (String args [])
6+ {
7+ Scanner in = new Scanner (System .in );
8+ int nm ,pn ,rev ,s =0 ,i ,c =0 ;
9+ System .out .println ("Enter No." );
10+ nm = in .nextInt (); // User input
11+ pn =nm ; // store the entered number in "pn" variable
12+ for (i =1 ;i <=pn ;i ++)
13+ {
14+ if (pn %i ==0 )
15+ {
16+ c ++;
17+ }
18+ }
19+ while (nm >0 )
20+ {
21+ rev =nm %10 ; // extract last digit of the number
22+ s =s *10 +rev ; // store the digit last digit
23+ nm =nm /10 ; // extract all digit except the last
24+ }
25+ if (pn ==s &&c ==2 ) // comparing with original number
26+ {
27+ System .out .println ("Number is PalPrime : " +pn );
28+ }
29+ else
30+ {
31+ System .out .println ("Number is not PalPrime : " +pn );
32+ }
33+ } // end of main method
34+ } // end of class
You can’t perform that action at this time.
0 commit comments