Везде значения вводятся с клавиатуры! на java если изучали массив: public class qwert { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int[] a = new int[5]; int k = 0; for (int i = 0; i < 5; i++) { a[i] = scn.nextInt(); k = k + a[i]; if (i == 4) System.out.println(k/i); } }} если не изучали массив: public class qwert { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int a = scn.nextInt(); int b = scn.nextInt(); int c = scn.nextInt(); int d = scn.nextInt(); int e = scn.nextInt(); int s = (a + b + c + d + e) / 5; System.out.println(s); }} на паскале через массив: var a:array [1..5] of integer; i:integer; s:real; begin for i := 1 to 5 do begin readln(a[i]); s := s + a[i]; if i = 5 then write (s/i); end; end. не через масивы: var a,b,c,d,e :integer; s:real; begin readln(a,b,c,d,e); s := (a+b+c+d+e)/5; write(s); end.
var a: array[1..MAX_SIZE] of integer; i, size: integer;
procedure delete_odd_elements(); var i, j: integer; begin i := 1; repeat if odd(a[i]) then begin dec(size); for j := i to size do a[j] := a[j + 1] end else inc(i); until i > size; end;
begin writeln('Исходный массив: '); size := MAX_SIZE; for i := 1 to size do begin a[i] := random(100); write(a[i] : 3); end; delete_odd_elements; writeln; writeln('Полученный массив: '); for i := 1 to size do write(a[i] : 3); end.