Prog. Pencarian hambatan
uses wincrt;
var hambatan1,hambatan2,t :
real;
a :
char;
begin
write
('hambatan 1 : ');readln (hambatan1);
write
('hambatan 2 : ');readln (hambatan2);
write
('kode pemasangan (p/s) : ');readln (a);
if
(a='p')or(a='P')
then
begin
t :=
1/((1/hambatan1)+(1/hambatan2));
end
else
begin
t := hambatan1 + hambatan2;
end;
writeln;
writeln
('Hambatan total :',t:1:2
);
end.
Program mencari mata uang
uses wincrt;
var uang :
longint;
begin
write('Nilai uang : ');readln(uang);
if uang div
100000 > 0
then
begin
writeln(uang div
100000,
' lembar seratus ribuan');
uang := uang mod
100000;
end;
if uang div
50000 > 0
then
begin
writeln(uang div
50000,
' lembar lima puluh ribuan');
uang := uang mod
50000;
end;
if uang div
20000 > 0
then
begin
writeln(uang div
20000,
' lembar dua puluh ribuan');
uang := uang mod
20000;
end;
if uang div
10000 > 0
then
begin
writeln(uang div
10000,
' lembar sepuluh ribuan');
uang := uang mod
10000;
end;
if uang div
5000 > 0
then
begin
writeln(uang div
5000,
' lembar lima ribuan');
uang := uang mod
5000;
end;
if uang div
1000 > 0
then
begin
writeln(uang div
1000,
' lembar ribuan');
uang := uang mod
1000;
end;
if uang div
500 > 0
then
begin
writeln(uang div
500,
' lembar lima ratusan');
uang := uang mod
500;
end;
if uang div
100 > 0
then
begin
writeln(uang div
100,
' ratusan');
uang := uang mod
100;
end;
if uang div
50 > 0
then
begin
writeln(uang div
50,
' limapuluhan');
uang := uang mod
50;
end;
if uang > 0
then
begin
writeln(uang,
' satuan');
end;
end.
0 komentar:
Posting Komentar