Untitled
unknown
plain_text
2 years ago
632 B
6
Indexable
public class Main
{
public static void main(String[] args) {
task1(531);
task1(530);
task1(532);
task1(534);
task1(536);
task1(538);
task1(0);
}
public static void task1(int num){
char[] arr = String.valueOf(num).toCharArray();
String check = arr[arr.length - 1] + "";
if(check.equals("1")){
System.out.println(num + " Компьютер");
} else if (check.equals("2") || check.equals("3") || check.equals("4")){
System.out.println(num + " Компьютера");
} else {
System.out.println(num + " Компьютеров");
}
}
}
Editor is loading...
Leave a Comment