- Algoritma Mencari IPK
Procedure IPK (input/output matkul[50] ::char , jmk :: integer, bsks::integer)
Deklarasi
x -> integer
bernilai[100]->integer
mutu[100]->integer
Deskripsi
for(x=1;x<=jmk;x++):
read(matkul[i]);
if (matkul[i]=='A') then bnilai[i]=4;
else if (matkul[i]=='B') then bernilai[i]=3;
else if (matkul[i]=='C') then bernilai[i]=2;
else if (matkul[i]=='D') then bernilai[i]=1;
else if (matkul[i]=='E') then bernilai[i]=0;
endif
read(bsks[x]);
if(bsks[x]>=1 && bsks[x]<=4) then bsks[x]= bsks[x];
endif
mutu[x]=bernilai[x]*bsks[x];
endfor
float tmutu=0, tbobot=0;
for(y=1; y<=jmk; y++):
tmutu+=mutu[y];
tbobot+=bsks[y];
endfor
float ipk;
ipk=tmutu/tbobot;
write(ipk).
EmoticonEmoticon