program procedure;
uses wincrt;
var
y,z: integer;
x : char;
i : integer;
procedure tambah(VAR a, b : integer);
var x : integer;
begin
x:=a+b;
WRITELN;
WRITELN('HASIL PENJUMLAHAN= ',x);
end;
procedure Kurang(var a,b : integer);
var
x : integer;
begin
x:=a-b;
WRITELN;
WRITELN('HASIL PENGURANGAN = ',x);
end;
procedure menu;
begin
GOTOXY(50,1);WRITELN(':::::::::KALKULATOR::::::::');WRITELN;
WRITELN(':::::::::::MENU:::::::::::');
WRITELN;
WRITELN(' 1. PENJUMLAHAN BILANGAN');
WRITELN(' 2. PENGURANGAN BILANGAN');
WRITELN(' 3. EXIT');
end;
begin
x:='y';
repeat
clrscr;
menu;
WRITE('PILIH SALAH SATU [1..3] = '); READLN(i);
WRITELN;
case i of
1 :begin
WRITE('MASUKKAN BILANGAN 1 = '); READLN (y);
WRITE('MASUKKAN BILANGAN 2 = '); READLN (z);
tambah(y,z);
end;
2 :begin
WRITE('MASUKKAN BILANGAN 1= ');READLN (y);
WRITE('MASUKKAN BILANGAN 2= '); READLN (z);
kurang(y,z);
end;
end;
write('APAKAH ANDA INGIN MENGULANG [Y/T] = ');
READLN(X);
CLRSCR;
UNTIL X <> 'Y';
donewincrt
END.
uses wincrt;
var
y,z: integer;
x : char;
i : integer;
procedure tambah(VAR a, b : integer);
var x : integer;
begin
x:=a+b;
WRITELN;
WRITELN('HASIL PENJUMLAHAN= ',x);
end;
procedure Kurang(var a,b : integer);
var
x : integer;
begin
x:=a-b;
WRITELN;
WRITELN('HASIL PENGURANGAN = ',x);
end;
procedure menu;
begin
GOTOXY(50,1);WRITELN(':::::::::KALKULATOR::::::::');WRITELN;
WRITELN(':::::::::::MENU:::::::::::');
WRITELN;
WRITELN(' 1. PENJUMLAHAN BILANGAN');
WRITELN(' 2. PENGURANGAN BILANGAN');
WRITELN(' 3. EXIT');
end;
begin
x:='y';
repeat
clrscr;
menu;
WRITE('PILIH SALAH SATU [1..3] = '); READLN(i);
WRITELN;
case i of
1 :begin
WRITE('MASUKKAN BILANGAN 1 = '); READLN (y);
WRITE('MASUKKAN BILANGAN 2 = '); READLN (z);
tambah(y,z);
end;
2 :begin
WRITE('MASUKKAN BILANGAN 1= ');READLN (y);
WRITE('MASUKKAN BILANGAN 2= '); READLN (z);
kurang(y,z);
end;
end;
write('APAKAH ANDA INGIN MENGULANG [Y/T] = ');
READLN(X);
CLRSCR;
UNTIL X <> 'Y';
donewincrt
END.
*SELAMAT MENCOBA*
YULIE
Tidak ada komentar:
Posting Komentar