program rata_rata;
uses wincrt;
var
x: array [1..100] of integer;
n,i,jmh : integer;
rata :real;
begin
write ('masukan banyak data :');
readln (n);
jmh :=0;
for i := 1 to n do
begin
write ('masukan nilai ke ',
i,':'); readln (x[i]);
jmh := jmh + x[i];
end;
rata :=jmh / n ;
writeln ('jumlah : ',jmh);
writeln ('ratarata: ',rata:0:2);
readln;
end.
0 komentar:
Posting Komentar