Skip to content

Instantly share code, notes, and snippets.

@dyazincahya
Last active September 26, 2017 12:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dyazincahya/0f91fe628d736b43868017f67dce4a9a to your computer and use it in GitHub Desktop.
Semua kodingan pascal :: semester 3
{ Author : Cahya Dyazin }
{ Blog : www.kang-cahya.com }
{ Version : 0.1 }
program NilaiMahasiswa;
type data = record
npm : String;
nama : String;
uts : Real;
uas : Real;
tugas : Real;
total : Real;
grade : Char;
end;
var mhs : data;
begin
with mhs do
begin
write('Masukan npm = '); readln(npm);
write('Masukan nama = '); readln(nama);
write('Masukan nilai uts = '); readln(uts);
write('Masukan nilai uas = '); readln(uas);
write('Masukan nilai tugas = '); readln(tugas);
{ This is a formula for search sum total }
total := (uts+uas+tugas)/3;
if (total > 0) and (total <= 30) then
begin
{ Grade E start from 1 until 30 }
grade := 'E'
end
else if (total > 30) and (total <= 50) then
begin
{ Grade D start from 31 until 50 }
grade := 'D'
end
else if (total > 50) and (total <= 70) then
begin
{ Grade C start from 51 until 100 }
grade := 'C'
end
else if (total > 70) and (total <= 90) then
begin
{ Grade B start from 71 until 100 }
grade := 'B'
end
else if (total > 90) and (total <= 100) then
begin
{ Grade A start from 91 until 100 }
grade := 'A'
end
else
begin
{ If result that grade is U, it's Unknow. U is acronym from UNKNOW }
grade := 'U';
end;
writeln('Npm = ', npm);
writeln('Nama = ', nama);
writeln('Nilai uts = ', round(uts));
writeln('Nilai uas = ', round(uas));
writeln('Nilai tugas = ', round(tugas));
writeln('Total Nilai = ', round(total));
writeln('Grade = ', grade);
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment