resistors quiz
Suppose we have circuits with series and parallel circuit of resistors. Your team will write one or more functions to calculate equivalent resistance of the circuit. The routine(s) you did shall support the following main program.
int main() {
float r2, r3, r4, r5;
r2 = parallelResistance( 1, 5); // 2 resistors in parallel
r3 = parallelResistance( 1, 5, 9); // 3 resistors in parallel
r4 = parallelResistance( 1, 5, 9, 6); // 4 resistors in parallel
r5 = serialResistance (8, r2); // see picture, R3 is 8 ohm
// You need to add code to print out the resistances and make the program work.
}
NOTES:
Can we have the same name, parallelResistance in this case, for three functions? One takes 2 parameters, one takes 3, and the other one takes 4?
Go one step further, can one function, parallelResistance, support two, three and four parameters?
The circuit diagram above can be represented in one instruction, how do you do it?