Jumat, 19 April 2013

Program Pascal untuk Ketegori Nilai

Menggunakan IF...THEN :


program nilai1;
uses wincrt;
var nilai:byte;
begin
write('masukkan nilai =');readln(nilai);
If (nilai<65) and (nilai>=50) Then
Writeln('D')
Else If (nilai<85) and (nilai>=75) Then
Writeln('B')
Else If (nilai<75) and (nilai>=65) Then
Writeln('C')
Else If (nilai<100) and (nilai>=85) Then
Writeln('A')
Else If nilai<=50 then
Writeln('E')
end.


Menggunakan Case...OF:


program nilai2;
uses wincrt;
var
Ket:String;
nilai:integer; 
begin
write ('masukkan nilai =');readln(nilai); 
case nilai of
86..100:Ket :='A';
76..85:Ket :='B';
61..75:Ket :='C';
51..60:Ket :='D';
0..50:Ket :='E';
end;
write('keterangan =',Ket);
end.

0 komentar:

Posting Komentar

You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "

Baca Selengkapnya Di : http://indonesianblog-jmk.blogspot.com/2012/06/cara-membuat-komentar-admin-berbeda.html#ixzz2kb6khEJE