Langsung aja dech cekidot :
Program Calculator;
uses crt;
const
Kol = 10; kol2=35;
Var
Bil1,Bil2,Bil3,Pilih : Integer;
procedure masukkan;
begin
clrscr;
gotoxy(kol2,4);writeln('----------------------');
gotoxy(kol2,5);writeln(' Masukan Bilangan ');
gotoxy(kol2,6);writeln('----------------------');
gotoxy(kol2,7);writeln('Bilangan 1 : ');
gotoxy(kol2,8);writeln('Bilangan 2 : ');
gotoxy(kol2,9);writeln('----------------------');
gotoxy(kol2,10);writeln('Hasil Operasi : ');
gotoxy(kol2,11);writeln('----------------------');
gotoxy(kol2+20,7);readln(bil1);
gotoxy(kol2+20,8);readln(bil2);
end;
Procedure Tambah;
begin
masukkan;
bil3 := bil1 + bil2;
gotoxy(kol2+20,10);writeln(bil1,'+',bil2,'=',bil3);
readln;
end;
Procedure Kurang;
begin
masukkan;
bil3 := bil1 - bil2;
gotoxy(kol2+20,10);writeln(bil1,'-',bil2,'=',bil3);
readln;
end;
Procedure Kali;
begin
masukkan;
bil3 := bil1 * bil2;
gotoxy(kol2+20,10);writeln(bil1,'*',bil2,'=',bil3);
readln;
end;
Procedure bagi_bulat;
begin
masukkan;
bil3 := bil1 div bil2;
gotoxy(kol2+20,10);writeln(bil1,'div',bil2,'=',bil3);
readln;
end;
Procedure Sisa_bagi;
begin
masukkan;
bil3 := bil1 mod bil2;
gotoxy(kol2+20,10);writeln(bil1,'mod',bil2,'=',bil3);
readln;
end;
(* Program Utama *)
begin
repeat
clrscr;
gotoxy(kol,4); writeln('--------------------------');
gotoxy(kol,5); writeln('Operasi Bilangan Bulat');
gotoxy(kol,6); writeln('--------------------------');
gotoxy(kol,7); writeln('1. Penambahan');
gotoxy(kol,8); writeln('2. Pengurangan');
gotoxy(kol,9); writeln('3. Perkalian');
gotoxy(kol,10);writeln('4. Pembagian Integer {Div} ');
gotoxy(kol,11); writeln('5. Sisa Hasil Bagi {Mod} ');
gotoxy(kol,12); writeln('6. Selesai');
gotoxy(kol,13); writeln('--------------------------');
gotoxy(kol,14); writeln('Pilihan Anda [1..6] : [ ] ');
gotoxy(kol,15);writeln('--------------------------');
gotoxy (kol+25,14);readln(pilih);
case pilih of
1 : Tambah;
2 : Kurang;
3 : Kali;
4 : Bagi_bulat;
5 : Sisa_bagi;
end;
until pilih = 6;
readln;
end.