Wednesday, April 30, 2014

praktikum (deret alpabet, kuadrat)

program rufita;
uses wincrt;
var hasil:real;
    i,pilih,a,b,n:integer; status:boolean;
begin
repeat
clrscr;
Writeln('== NAMA:RUFITA SARI == NIM:111210293 == KELAS:G ==');
Writeln('==================================================');
writeln('* (1).Penjumlahan dua bilangan (2).Deret kuadrat *');
writeln('* (3).Deret Alphabet           (4).Keluar (stop) *');
writeln('**************************************************');
write('Masukkan Pilihan Anda: '); readln (pilih);
writeln;
case pilih of
1:begin
     writeln('Program Penjumlahan Dua Bilangan');
     writeln('-------------------------------');
     write('masukkan bilangan 1: '); readln(a);                              
     write('masukkan bilangan 2: '); readln(b);
     hasil:=a+b;                     
     writeln('hasilnya adalah: ',hasil:2:0);
     writeln;
     write('coba lagi!! [enter]');
     status:=false;
  end;
2:begin
     writeln('Program Deret Kuadrat');
     writeln('---------------------');
     write('masukkan jumlah deret: ');readln(n);
     i:=0;     
     while i < n do
  begin
     i:= i + 1;
     a := i * i;                         
     write( a,' ');
  end;
     writeln;
     writeln;
     write('coba lagi!! [enter]');
  end;
3:begin
     writeln('Program Deret Alphabet');
     writeln('----------------------');
     i:=91;
     repeat i:=i-1;
     write(chr(i),' ');
     until i=65;
     writeln;
     writeln;
     write('coba lagi!! [enter]');
  end;  
4:begin
     write('Program Berhenti..!!!');
     status:=true;
  end;
     else
  begin
     writeln('pilihan anda salah...!!!');
     status:=true;
  end;
  end;
     readln;
     until status;
end.

No comments:

Post a Comment