Hey guys, I have a problem with my homework that I can't solve.
Every time I run the program, b[n] equals 0, yet the numbers are entered correctly.
I don't know why it does it, can anyone help?
#include <stdio.h>
void main ()
{
int v,n,a[]={20,40,30,50,40,60};
float i,r,b[6];
i=r=0;
v=10;
for(n=0;n<6;n++)
{
b[n]=(10/a[n]);
printf("I%d = %fA\n",n,b[n]);
}
for(n=0;n<6;n++)
{
i=b[n]+i;
}
r=10/i;
printf("Rt= %f\n It= %f\n",r,i);
}
Edit: I tried adding the math.h library; no luck.