program kalkulator_sederhana;
uses crt;
var
x, y, hasil : real;
operator : char;
begin
clrscr;
write ('masukan angka pertama : ');
readln (x);
write ('pilih operator (+)/(-)/(*)/(/) : ');
readln (operator);
write ('masukan angka kedua : ');
readln (y);
if operator = '+' then
begin
hasil := x+y
end;
if operator = '-' then
hasil := x-y
end;
if operator = '*' then
hasil := x*y
end;
if operator = '/' then
hasil := x/y
end;
write ('hasilnya : ', hasil :2:2);
readln;
end.
Semoga kgk error kl dirun, :D
0 comments:
Post a Comment
biasakan meninggalkan komentar setelah membaca