Hi, I'm a beginner programming and have run into a problem on a project. Here's my loop.
while(scanf("%d", &x) != EOF)
a = 1 / x;
b += a;
c = d / b;
This loop is supposed to calculate the harmonic mean of a number series. The problem here is with the variable "b". I get an error with that because it is not assigned a value. Normally I would set a variable like "b" to 0 when I declare it but since I divided 1 by "x" variable "b" remains 0 for some reason and that's what the loop spits out. What's the problem here?