Selamat Datang Di Kelas Produktif Teknik Komputer Jaringan

27 September 2014

program pascal rata rata nilai mahasiswa

program nilai;
uses crt;
const n=3;
      m=1;
type mhs=record
     nama:string;
     npm:string;
     nilai:array[1..m] of integer;
end;

var
l:array[1..n] of mhs;
i,j,jml:integer;

procedure input;
begin
for i:=1 to n do
  begin
   write('nama:');readln(l[i].nama);
   write('npm:'); readln(l[i].npm);

   for j:=1 to m do
     begin
       write('nilai:');readln(l[i].nilai[j]);
   end;
 end;
end;

procedure output;
var
k:real;
   begin
   for i:=1 to n do
     begin
     jml:=0;
     writeln(l[i].nilai[j]);
     jml:=jml+l[i].nilai[j];
     end;
    
k:=jml/m;
writeln('rata:',k:1:2);
end;

begin
input;
output;
readln;
end.