-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExample7.java
39 lines (35 loc) · 951 Bytes
/
Example7.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class Example7 {
// 1..10 oraliqda son berilgan
// toq yoki juftga tekshirilsin
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
/*
if (1 <= n && n <= 10) {
if (n % 2 == 1) System.out.println("toq son");
else System.out.println("juft son");
} else {
System.out.println("Oraliqqa tegishli emas");
}
*/
switch (n) {
case 1:
case 3:
case 5:
case 7:
case 9:
System.out.println("Toq son");
break;
case 2:
case 4:
case 6:
case 8:
case 10:
System.out.println("Juft son");
break;
default:
System.out.println("Oraliqqa tegishli emas");
}
}
}