PROGRAM TEN
Given that the reactance (Xc) of a capacitor equals 1 / (2PIfC),
where f is the frequency in hertz, C is the capacitance in farads,
and PI is 3.14159, write a program that displays the reactance of
five successive capacitor's (their value typed in from the keyboard),
for the frequency range 100 to 1000 hertz in 10hz steps.
program PROG10 (input, output);
const PI = 3.14159;
var frequency , loopcount, innerloop : integer;
capacitor, Xc : real;
begin
for loopcount := 1 to 5 do
begin
writeln;
writeln('Enter capacitance farad value for capacitor #',
loopcount);
readln( capacitor );
for innerloop := 1 to 10 do
begin
frequency := innerloop * 100;
Xc := 1 / ( 2 * PI * frequency * capacitor );
write('At ',frequency:4,'hz ');
writeln('the reactance is ', Xc,' ohms.')
end
end
end.
Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.