Senin, 06 Januari 2020

pascal, Perhitungan nilai akhir

Program penentu_nilai;
uses crt;
type
arr = array[1..4] of byte;
var
n     : arr;
jawab : char;
procedure input;
var i : byte;
begin
gotoxy(3,1); write(' Perhitunga Nilai Akhir');
gotoxy(3,2); write('================================');
gotoxy(3,4); write('Nilai Presentasi           : ');
gotoxy(3,5); write('Nilai TM                   : ');
gotoxy(3,6); write('Nilai Mid                  : ');
gotoxy(3,7); write('Nilai ujian akhir semester : ');
gotoxy(3,8); write('Nilai Akhir                : ');
gotoxy(38,8); write('====> Grande : ');
for i := 1 to 4 do
begin
   repeat
         gotoxy(21,3+i);clrEol;
         gotoxy(21,3+1);readln(N[i]);
           until N[i] in [0..100];
     end;
   end;
   procedure Hitung;
var
akhir : real;
grade : char;
begin
   akhir :=(0.1*N[1])+(0.1*N[2])+(0.3*N[3])+(0.5*N[4]);
gotoxy(21,8); write (akhir:-5:2);
if akhir >= 85 then grade :='A' else
  if akhir >=75 then grade :='B' else
    if akhir >=65 then grade :='C' else
      if akhir >=55 then grade :='D' else grade :='E';
        gotoxy(46,8); write(grade);
  end;
  begin
   repeat
   input;
   Hitung;
   gotoxy(13,10); write('Mau coba lagi Y/T? : ');
   repeat
         gotoxy(36,10); jawab:=Upcase(readkey);
         until(jawab='Y') or (jawab='T');
           write(jawab);
         until (jawab ='T');
end.

Ditulis : Muh Ridho Wachid S

Tidak ada komentar:

Posting Komentar