Minggu, 14 Maret 2010

Program hitung Tegangan atau daya pada suatu rangkaian

Program tegangan_atau_daya;

Uses wincrt;

Var
Power, voltage, current, resistance: Integer;
Pilihan: Char;
Begin
Write ('Input current: '); Readln (current);
Write ('Input resistance: '); Readln (resistance);
Writeln ('pilihan input: ');
Writeln ('A. Voltage');

Writeln ('B. Power.');

Write ('Pilihan (A/B): '); Readln (Pilihan);
If Pilihan = 'A' then
Begin
voltage := current * resistance;
writeln ('Voltage: ',Voltage);
End;
If Pilihan = 'B' then
Begin
Keliling := (current * current * resistance);
writeln ('Power: ',power);
End;
End.

Tidak ada komentar: