NESTED LOOPS
A for loop can occur within another, so that the inner loop
(which contains a block of statements) is repeated by the outer loop.
RULES RELATED TO NESTED FOR LOOPS
1. Each loop must use a seperate variable
2. The inner loop must begin and end entirely within the outer loop.
program NESTED_FOR_LOOPS (output); var line, column : integer; begin writeln('LINE'); for line := 1 to 6 do begin write( line:2 ); for column := 1 to 4 do begin write('COLUMN':10); write(column:2) end; writeln end end. Click here for answer
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 ELEVEN
The factorial of an integer is the product of all integers up to
and including that integer, except that the factorial of 0 is 1.
eg, 3! = 1 * 2 * 3 (answer=6)Evaluate the factorial of an integer less than 20, for five numbers input successively via the keyboard.