Well guys I think I did it
Code:
double R_Parallel(double fUin, double fRo) {
// Internal variables for function
int nHelp, nCount = 0; // Help and Counter
double fPRE; //Pralaller Resistance Equivelant
double fResistor; //Resistor
double fUout; //Uout is the final output voltage after the voltage divider
while (1) { //WHILE 1
printf("\nPlease input parallel resistant number %d,\ninput a negative value to finish the operation: \n", nCount);
scanf("%lf", &fResistor);
if(fResistor <= 0) { printf("\nStopping the program since a negative value is entered, the last calulated output voltage is %f Volts.", fUout); break;}
nCount++;
// Special case for first entered resistor, it will be in series with Ro
if(nCount == 1) {fPRE = fResistor;}
// Calculating total resistance for more thatn
if(nCount != 1){
fPRE = 1/((1/fPRE)+(1/fResistor));
}
fUout = (fRo/(fRo+fPRE))*fUin;
printf("\nU out is now %f Volts.\n", fUout);
}//END WHILE 1
return (0);
}