Kamis, 21 Mei 2009

Tugas Pemograman Pascal Tentang Nilai Praktikum /Lulus/Tidak Lulus

Ini Dia Souce Codenya saya buatkan :
Program Praktikum;
uses crt;
const
maks = 50;
var
no :array [1..maks] of byte;
nama:array [1..maks] of string;
npm :array [1..maks] of string;
na :array [1..maks] of real;
hm :array [1..maks] of char;
ket :array [1..maks] of string;
i,nu,ns,nt,l,r,z:byte;
a,b,c:real;
ts:string;
begin
clrscr;
z:=0;
r:=0;
write('Jumlah Mahasiswa (maksimum 50) : ');readln(l);
for i:=1 to l do
begin
write('No : ');readln(no[i]);
write('Nama : ');readln(nama[i]);
write('NPM : ');readln(npm[i]);
write('Nilai Tugas : ');readln(nt);
write('Nilai UTS : ');readln(nu);
write('Nilai UAS : ');readln(ns);
writeln;
a:=(0.2*nt);
b:=(0.3*nu);
c:=(0.5*ns);
na[i]:=(a+b+c);
if (na[i]>=0) and (na[i]<=45) then

begin
hm[i]:='E';
ket[i]:='Tidak Lulus';
inc(z);
end
else if (na[i]>=46) and (na[i]<=65) then
begin
hm[i]:='D';
ket[i]:='Tidak Lulus';
inc(z);
end
else if (na[i]>=66) and (na[i]<=75) then
begin
hm[i]:='C';
ket[i]:='Lulus';
inc(r);
end
else if (na[i]>=76) and (na[i]<=85) then
begin
hm[i]:='B';
ket[i]:='Lulus';
inc(r);
end
else if (na[i]>=86) and (na[i]<=100) then
begin
hm[i]:='A';
ket[i]:='Lulus';
inc(r);
end;
end;
clrscr;
gotoxy(10,1);writeln('Daftar Nilai Praktikum');
ts:='4 November 1999';
writeln('Tanggal : ',ts,' hal:1');
writeln;
gotoxy(1,4);write('No');
gotoxy(5,4);write('Nama');
gotoxy(30,4);write('NPM');
gotoxy(42,4);write('NA');
gotoxy(49,4);write('HM');
gotoxy(57,4);write('Ket');
for i:=1 to l do
begin
gotoxy(1,(i+5));write(no[i]);
gotoxy(5,(i+5));write(nama[i]);
gotoxy(30,(i+5));write(npm[i]);
gotoxy(42,(i+5));write(na[i]:0:2);
gotoxy(49,(i+5));write(hm[i]);
gotoxy(57,(i+5));write(ket[i]);
end;
writeln;
writeln('Keterangan : ');
writeln(' Jumlah Mahasiswa yang lulus : ',r,' orang');
writeln(' Jumlah Mahasiswa yang tidak lulus : ',z,' orang');
readln;
end.




Reaksi:

0 komentar: