Anda di halaman 1dari 3

# uses crt;

var
n,i,total:integer;
b:array[1..100] of integer;
rata:real;
begin
total:=0;
clrscr;
writeln('##################################################');
writeln('# #');
writeln('# Program mencari nilai rata-rata #');
writeln('# #');
writeln('##################################################');
writeln;
write('masukan banyak bilangan = '); readln(n);
for i:= 1 to n do begin
total:=total+b[n];
end;
rata:=total / n;
writeln;
writeln('jumlah bilangan = ' ,total);
writeln('rata-rata bilangan = ',rata:0:2);
end.

program array_1dimensi;
uses crt;
var
tugas,mid,final : array[1..10] of integer;
rata : array[1..10] of real;
i,byk : byte;
tambah : char;
label input;
begin
input:
for i:=1 to byk do
begin
write('Nilai tugas :');
write('Nilai Mid :');
write('Nilai Final :');
rata[i]:=(tugas[i]+mid[i]+final[i])/3;
end;
clrscr;
for i:=1 to byk do
begin
writeln('-----------------------------------');
writeln('| No. | Nilai | Rata |');
writeln('| |---------------------| |');
writeln('| | Tugas | Mid | Final | |');
writeln('-----------------------------------');
for i:=1 to byk do
begin
write('|',i,'|',tugas[i],'|',mid[i],'|',final[i],'|,rata[i]:2:2,'|');
end;
writeln('-----------------------------------');
write('Ingin input data nilai lagi [Y/T]?');readln(tambah);
if (tambah='Y') or (tambah='y') then
goto input;
end;
clrscr;
end.

## Output dari listing diatas adalah sebagai berikut :

### Dapatkan aplikasi gratis kami

Hak cipta © 2022 Scribd Inc.

### Dapatkan aplikasi gratis kami

Hak cipta © 2022 Scribd Inc.