package znaniya; import java.util.Scanner; public class Znaniya { public static void main(String[] args) { System.out.print("Введите оценку:"); Scanner sc = new Scanner(System.in); int max = sc.nextInt(); switch (max) { case 1: System.out.println("Кол"); break; case 2: System.out.println("Два"); break; case 3: System.out.println("Три"); break; case 4: System.out.println("Четыре"); break; case 5: System.out.println("Пять"); break; default: System.out.println("Ошибка"); } } }
1 задача program proga; var st,st2:string; i:Integer; begin writeln('Введите число'); readln(st); for i:=1 to length(st) do begin st2:=st[i]; write(st2,' '); end; end. 2 задача program proga2; var st,st2:string; i,a:Integer; begin writeln('Введите возраст'); readln(a); if a>120 then writeln('Неверные данные'); if a=1 then writeln(a,' год'); if (a>1) and (a<5) then writeln(a,' года'); if((a mod 10 = 1) and (a div 10 <> 0 or 11 )) then writeln(a,' год'); if (a>=5) and (a mod 10 <> 2 or 3 or 4)and (a div 10 <> 10) then writeln(a,' лет'); if (a<=5) and (a mod 10 = 2 or 3 or 4)and (a div 10 = 10) then writeln(a,' года '); if(a>104) and (a<110)then writeln(a,' лет'); end.
import java.util.Scanner;
public class Znaniya {
public static void main(String[] args) { System.out.print("Введите оценку:"); Scanner sc = new Scanner(System.in); int max = sc.nextInt(); switch (max) { case 1: System.out.println("Кол"); break; case 2: System.out.println("Два"); break; case 3: System.out.println("Три"); break; case 4: System.out.println("Четыре"); break; case 5: System.out.println("Пять"); break; default: System.out.println("Ошибка"); } } }