Program ratarata;
uses wincrt;
var
a:array[1..100] of integer;
i,n,sum,tuntas,nilai:integer;
rata,nr:real;
begin
Write('jumlah siswa : ');
Readln(n);
Writeln;
Write('ketuntasan nilai siswa yang diinginkan : ');
Readln(tuntas);
Writeln;
sum:=0;
For i:=1 to n do
begin
Write('nilai siswa ke ',i, ': ');
Readln(a[i]);
sum:=sum+a[i];
if a[i] <tuntas then
begin
nilai:=tuntas-a[i];
Writeln('anak ke ',i,' kurang ',nilai,' nilai untuk tuntas');
end
else
Writeln('anak ke ',i,' sudah tuntas');
end;
for i:= 1 to n do
rata:=sum/n;
Writeln(rata:0:2);
Writeln;
end.
uses wincrt;
var
a:array[1..100] of integer;
i,n,sum,tuntas,nilai:integer;
rata,nr:real;
begin
Write('jumlah siswa : ');
Readln(n);
Writeln;
Write('ketuntasan nilai siswa yang diinginkan : ');
Readln(tuntas);
Writeln;
sum:=0;
For i:=1 to n do
begin
Write('nilai siswa ke ',i, ': ');
Readln(a[i]);
sum:=sum+a[i];
if a[i] <tuntas then
begin
nilai:=tuntas-a[i];
Writeln('anak ke ',i,' kurang ',nilai,' nilai untuk tuntas');
end
else
Writeln('anak ke ',i,' sudah tuntas');
end;
for i:= 1 to n do
rata:=sum/n;
Writeln(rata:0:2);
Writeln;
end.
No comments:
Post a Comment