Minggu, 16 Desember 2012

array data mahasiswa


program array_1Dimensi;
uses
 winCrt;
var
 nim,nm,smstr,mk,grade:array[1..4] of string;
 nh,uts,uas:array[1..4] of integer;
 na:array[1..4] of real;
 i:byte;
begin
  writeln('PROGRAM MENCETAK NILAI MHS');
  writeln('--------------------------');
 for i:= 1 to 2 do
 begin
 writeln('Input Data Mahasiswa ke ',i);  
  write('NIM         : ');readln(nim[i]);
  write('Nama        : ');readln(nm[i]);
  write('Semester    : ');readln(smstr[i]);
  write('Mata Kuliah : ');readln(mk[i]);
  write('Nilai Harian: ');readln(nh[i]);
  write('Nilai UTS   : ');readln(uts[i]);
  write('Nilai UAS   : ');readln(uas[i]);
  writeln('******************************');
  NA[i]:= 0.2*NH[i]+0.3*UTS[i]+0.5*UAS[i];
  if na[i] >= 90 then
     grade[i]:='A' else
  if na[i] >= 80 then
     grade[i]:='B+' else
  if na[i] >= 70 then
     grade[i]:='B' else
  if na[i] >= 60 then
     grade[i]:='C+' else
  if na[i] >= 50 then
     grade[i]:='C' else
  if na[i] >= 30 then
     grade[i]:='D'
  else
     grade[i]:='E';
 end; clrscr;
 writeln('DATA NILAI MHS SEBAGAI BERIKUT :');
 writeln('--------------------------------');
 for i:= 1 to 2 do
 begin
 writeln('Mahasiswa ke ',i);
  writeln('NIM          : ',nim[i]);
  writeln('Nama         : ',nm[i]);
  writeln('Mata Kuliah  : ',mk[i]);
  writeln('Nilai Akhir  : ',na[i]:3:0);
  writeln('Grade        : ',grade[i]);
  writeln('-------------------------------');
 end;
end.

Tidak ada komentar:

Posting Komentar

array data mahasiswa

program array_1Dimensi; uses  winCrt; var  nim,nm,smstr,mk,grade:array[1..4] of string;  nh,uts,uas:array[1..4] of integer;  na:array...