-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFun28.java
More file actions
24 lines (22 loc) · 572 Bytes
/
Fun28.java
File metadata and controls
24 lines (22 loc) · 572 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package fun;
public class Fun28 {
public static void main(String[] args) {
System.out.println(tub(2));
System.out.println(tub(3));
System.out.println(tub(4));
System.out.println(tub(5));
System.out.println(tub(6));
System.out.println(tub(7));
}
// n = 51
// 2 3 4 5 ... 50
public static boolean tub(int number) {
int i = 2;//4
while (i < number) {
if (number % i == 0)
return false; // tub emas
i++;
}
return true; // tub
}
}