uses crt;
var a,b:integer;
hasil1:longint;
hasil2:real;
begin
writeln('kalkulator mini');
write('masukkan bilangan bulat a= ');readln(a);
write('masukkan bilangan bulat b= ');readln(b);
hasil1:=a+b;
writeln('hasil ',a,' + ',b,' = ',hasil1);
hasil1:=a-b;
writeln('hasil ',a,' - ',b,' = ',hasil1);
hasil1:=b-a;
writeln('hasil ',b,' - ',a,' = ',hasil1);
hasil1:=a*b;
writeln('hasil ',a,' * ',b,'= ',hasil1);
hasil2:=a/b;
writeln('hasil ',a,'/ ',b,' = ',hasil2:4:2);
hasil2:=b/a;
writeln('hasil ',b,'/ ',a,' = ',hasil2:4:2);
hasil2:=sqrt(a);
writeln('hasil akar a= ',hasil2:4:2);
hasil2:=sqrt(b);
writeln('hasil akar b= ',hasil2:4:2);
hasil2:=sqr(a);
writeln('hasil pangkat a= ',hasil2:4:2);
hasil2:=sqr(b);
writeln('hasil pangkat b= ',hasil2:4:2);
end.
var a,b:integer;
hasil1:longint;
hasil2:real;
begin
writeln('kalkulator mini');
write('masukkan bilangan bulat a= ');readln(a);
write('masukkan bilangan bulat b= ');readln(b);
hasil1:=a+b;
writeln('hasil ',a,' + ',b,' = ',hasil1);
hasil1:=a-b;
writeln('hasil ',a,' - ',b,' = ',hasil1);
hasil1:=b-a;
writeln('hasil ',b,' - ',a,' = ',hasil1);
hasil1:=a*b;
writeln('hasil ',a,' * ',b,'= ',hasil1);
hasil2:=a/b;
writeln('hasil ',a,'/ ',b,' = ',hasil2:4:2);
hasil2:=b/a;
writeln('hasil ',b,'/ ',a,' = ',hasil2:4:2);
hasil2:=sqrt(a);
writeln('hasil akar a= ',hasil2:4:2);
hasil2:=sqrt(b);
writeln('hasil akar b= ',hasil2:4:2);
hasil2:=sqr(a);
writeln('hasil pangkat a= ',hasil2:4:2);
hasil2:=sqr(b);
writeln('hasil pangkat b= ',hasil2:4:2);
end.
0 Response to "Contoh Program Pascal kalkulator sederhana "
Posting Komentar