File tree Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ /**
3
+ Solved by
4
+ K.S.VIDHYA
5
+ 111712205105 IT-B
6
+
7
+ */
8
+
9
+
10
+
11
+ public class xxxx
12
+ {
13
+
14
+ /**
15
+ * @param args
16
+ */
17
+ public static void main (String [] args )
18
+ {
19
+ int i ;
20
+ for ( i =510 ;;i ++)
21
+ if (isprime (i ))
22
+ if (i >0 &&!((i &(i -1 ))==1 ))
23
+ {
24
+ System .out .println (i );
25
+ break ;
26
+ }
27
+ for ( i =0 ;;i =i =i +2 )
28
+ if (i %2 ==0 )
29
+ if (i >0 &&!((i &(i -1 ))==1 ))
30
+ {
31
+ System .out .println (i );
32
+ break ;
33
+ }
34
+ for ( i =1 ;;i =i =i +2 )
35
+ if (i %2 !=0 )
36
+ if (i >0 &&!((i &(i -1 ))==1 ))
37
+ {
38
+ System .out .println (i );
39
+ break ;
40
+ }
41
+ for ( i =2 ;;i =i =i *2 )
42
+ if (i >0 &&!((i &(i -1 ))==1 ))
43
+ {
44
+ System .out .println (i );
45
+ break ;
46
+ }
47
+
48
+
49
+ }
50
+ public static boolean isprime (int j )
51
+ {
52
+ int x =0 ;
53
+ if (j <2 )
54
+ return false ;
55
+ if (j %2 ==0 && j !=2 )
56
+ return false ;
57
+ for (int i =3 ;i <=Math .sqrt (j );i =i +2 )
58
+ if (j %i ==0 )
59
+ {
60
+ x ++;
61
+ break ;
62
+ }
63
+ if (x ==0 )
64
+ return true ;
65
+ else
66
+ return false ;
67
+ }
68
+
69
+ }
You can’t perform that action at this time.
0 commit comments