program ipk pascal procedure

contoh program sederhana ipk di program pascal

uses    crt;
var     sks,nilai,jml_sks,jml_mutu,c,n,i:integer;
        rata:real;
procedure  kali(a,b:integer);
begin
        c:=a*b;

end;

procedure       jumlah_sks(a:integer);

begin
        jml_sks:=jml_sks+a;
end;

procedure       jumlah_mutu(c:integer);

begin
        jml_mutu:=jml_mutu+c;
end;

procedure       rata_rata(a,b:real);
begin
        rata:=jml_mutu/jml_sks;
end;

begin
        clrscr;
        write('banyak mata kuliah: ');
        readln(n);
        writeln();
        for i:= 1 to n do
        begin
                write('sks ke- ',i,' = ');
                readln(sks);
                write('nilai ke-',i,' = ');
                readln(nilai);
                kali(sks,nilai);
                writeln('mutu ke-',i,' = ',c);
                jumlah_sks(sks);
                jumlah_mutu(c);
                writeln;
        end;
        writeln('jumlah sks = ',jml_sks);
        writeln('jumlah mutu = ',jml_mutu);
        rata_rata(jml_sks,jml_mutu);
        writeln('rata rata ipk = ',rata:2:2);
        readkey();
end.


Tidak ada komentar:

Posting Komentar