Page 601 - Computer science 868 Class 12
P. 601
38 Binary ob=new Binary();
39 ob.readBin();
40 ob.show();
41 }
42 }
Output of the preceding program is as follows:
ENTER A BINARY NUMBER
11
BINARY NUMBER: 11
ITS DECIMAL EQUIVALENT: 3
PROGRAM ON NUMBERS
Program 14 A Circular Prime is a prime number that remains prime under cyclic shifts of its digits. When
the leftmost digit is removed and replaced at the end of the remaining string of digits, the
generated number is still prime. The process is repeated until the original number is reached
again.
A number is said to be prime if it has only two factors 1 and itself.
Example:
131, 311 , 113 Hence, 131 is a circular prime.
1 import java.util.*;
2 class Circular_prime
3 {
4 boolean flag;
5 String num;
6 void input()
7 {
8 flag=true;
9 Scanner sc=new Scanner(System.in);
10 System.out.println("Enter the number");
11 num=sc.next();
12 check(num);
13 }
14 boolean isPrime(int no)
15 {
16 int c=0;
17 for(int i=1;i<=no;i++)
599
Internal Assessment 599

