help! calculate arbitrary number of floating points

hello i am new to c programming. i need to enter an arbitrary number of floating points and plug these numbers inthe the formula

1/Rn = 1/R1 + 1/R2 + ....+ 1/Rt

i need to do this in ohms so the 1/Rn, so the answer will end up being the reciprocal of the numbers after they are added together. i am using a while, break loop...is this right? here is what i have so far if anyone has any suggestions. THanks!

Code:

int main()

{

double r1;

double resistance = 0.0;

printf(" This program calculates the total resistance \n");

printf("of n resistors connected in parallel.\n");

printf("\n");

printf("Enter the resistance or EOF to end input:\n");

while ( 1 ) {

scanf("%lf", &r1);

if ( r1 == (EOF || 0) )

break;

resistance += (1/r1);

}

if (resistance == 0)

printf("\nNo values entered.\n\n");

else

printf("\nTotal resistance of the ciruit is %.3f ohms\n", 1/resistance);

system("pause");

return 0;

}