hey everybody. im was doing a bit of practice to make a programme which would calculate the total resistance and 3 resistors if they were in parallel and in series, when it compiles it keeps saying "floating point exception", can some body please explain what this means. here is the code which i have written:
Code:
#include<stdio.h>
#include<math.h>
int main (void)
{
int r1,r2,r3;
float rp, rs;
r1 = 2000;
r2 = 1500;
r3 = 750;
printf("the value of 3 resistors are\n");
printf("r1 = %d\n", r1);
printf("r2 = %d\n", r2);
printf("r3 = %d\n\n", r3);
rs = r1 + r2 + r3;
rp = 1/((1/r1)+(1/r2)+(1/r3));
printf("if the resistors were in series\ntotal resistance would be %f\n", rs);
printf("if the resistors where in parallel\ntotal resistance would be %f\n ", rp);
return 0;
}
and here is the output which keeps popping up:
the values of the 3 resistors are
r1 = 2000
r2 = 1500
r3 = 750
floating point exception