Tính trung bình cộng các số lẻ trong mảng năm 2024

program hotrotinhoc;

var a: array[1..32000] of integer;

d,i,n: integer;

s: longint;

t: real;

begin

write['n=']; readln[n];

for i:=1 to n do

begin

write['a[',i,']=']; readln[a[i]];

end;

d:=0; s:=0;

for i:=1 to n do

if a[i] mod 2=1 then

begin

s:=s+a[i];

inc[d];

end;

t:=s/d;

write[t:1:2];

readln

end.

program TinhTBCTimSoNT;

var ten, lop: string; n, i, tong, dem: integer; A: array [1..11] of integer; trung_binh: real;

function LaSoNguyenTo[x: integer]: boolean; var i: integer; begin if x < 2 then LaSoNguyenTo := false else if x = 2 then LaSoNguyenTo := true else if x mod 2 = 0 then LaSoNguyenTo := false else begin i := 3; while [i

Chủ Đề