Page 535 - Cs_withBlue_J_C11_Flipbook
P. 535

24              x=num;
                   25              while(x!=0)

                   26              {
                   27                  rev=rev*10 + x%10;

                   28                  x=x/10;
                   29              }

                   30              orgnum=isprime(f);
                   31              num=rev;
                   32              f=2;

                   33              revnum=isprime(f);

                   34              if(orgnum==1 && revnum==1)
                   35                  System.out.println(num+"is an emirp no");
                   36              else

                   37                  System.out.println(num+"is not an emirp no.");
                   38          }

                   39
                   40          public static void main(String[] args)

                   41          {
                   42              int numcheck;

                   43              Scanner sc= new Scanner(System.in);
                   44              System.out.println("Enter the number:");

                   45              numcheck=sc.nextInt();
                   46              Emirp obj=new Emirp(numcheck);

                   47              obj.isEmirp();
                   48          }

                   49      }


                 The output of the preceding program is as follows:
                 Enter the number: 71
                 17is an emirp no


                                                            Variable Description
                   NAME         TYPE                                       DESCRIPTION
                  num        int          To store the num
                  rev        int          Reverse of num

                  f          int          Flag variable
                  x          int          Temporary variable to store the sum


                                                                                                                       533
                                                                                                   Internal Assessment  533
   530   531   532   533   534   535   536   537   538   539   540