Untitled

 avatar
unknown
plain_text
a year ago
632 B
4
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