Page 602 - Computer science 868 Class 12
P. 602

18       {
                19       if(no%i==0)

                20       c++;
                21       }
                22       if(c==2)

                23       return true;

                24       else
                25       return false;
                26       }

                27       void check(String str)
                28       {

                29          String s;
                30             int l=str.length();

                31             for(int i=0;i<str.length();i++)
                32             {  s=str.substring(1)+str.charAt(0);

                33                 System.out.println(s);
                34                 if(!isPrime(Integer.parseInt(s)))

                35              {
                36                  flag=false;

                37              }
                38

                39                 str=s;
                40               }

                41                if(flag)
                42       System.out.println("YES , IT IS A CIRCULAR PRIME NUMBER."+num);

                43       else
                44       System.out.println("NO , IT IS NOT A CIRCULAR PRIME NUMBER."+num);

                45          }
                46       }

              Output of the preceding program is as follows:
              Enter the number
              113
              131
              311
              113
              YES , IT IS A CIRCULAR PRIME NUMBER.113


                600600  Touchpad Computer Science-XII
   597   598   599   600   601   602   603   604   605   606   607