hello,

i need to write a program that computes an equivalent resistor value if it is in either series or parallel . (in c++).

how will i write this in c++ :

[TEX] R_\mathrm{eq} = R_1 \| R_2 = {R_1 R_2 \over R_1 + R_2} [/TEX] (parallel)

[TEX] R_\mathrm{eq} = R_1 + R_2 + \cdots + R_n[/TEX](series)

thank you