-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitch18.java
More file actions
116 lines (104 loc) · 2.96 KB
/
switch18.java
File metadata and controls
116 lines (104 loc) · 2.96 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package swichcase;
import java.util.Scanner;
public class switch18 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
System.out.println("Num:");
int n=scanner.nextInt();
if (n>99 &&n<1000 ){
int hundred=n/100;
int decimal=(n%100)/10;
int unit= (n%100)%10;
result(hundred,decimal,unit);
}
else {
System.err.println("Son oralig`i 100...999 ! ");
}
}
private static void result(int hundred,int decimal,int unit) {
switch (hundred){
case 1:
System.out.print("yuz " );
break;
case 2:
System.out.print("ikki yuz ");
break;
case 3:
System.out.print("uch yuz ");
break;
case 4:
System.out.print("to`rt yuz ");
break;
case 5:
System.out.print("besh yuz ");
break;
case 6:
System.out.print("olti yuz ");
break;
case 7:
System.out.print(" yetti yuz ");
break;
case 8:
System.out.print("sakkiz yuz ");
break;
case 9:
System.out.print("to`qqiz yuz ");break;
}
switch (decimal){
case 1:
System.out.print("o`n " );
break;
case 2:
System.out.print("yigirma ");
break;
case 3:
System.out.print("o`ttiz ");
break;
case 4:
System.out.print("qiriq ");
break;
case 5:
System.out.print("elik ");
break;
case 6:
System.out.print("oltmish ");
break;
case 7:
System.out.print("yetmish ");
break;
case 8:
System.out.print("sakson ");
break;
case 9:
System.out.print("to`xson ");break;
}
switch (unit){
case 1:
System.out.print("Bir " );
break;
case 2:
System.out.print("Ikki ");
break;
case 3:
System.out.print("Uch ");
break;
case 4:
System.out.print("To`rt");
break;
case 5:
System.out.print("besh ");
break;
case 6:
System.out.print("olti");
break;
case 7:
System.out.print("yetti ");
break;
case 8:
System.out.print("sakkiz");
break;
case 9:
System.out.print("to`qqiz");break;
}
}
}