#include<stdio.h>
#include<math.h>
#include<string.h>
// function prototype
int rv (int, int [], double []);
//main function
int main()
{
int n;
int res[10];
double vol[10];
double I[10];
double C;
int i;
for (i = 0; i < 10; i++)
{
printf("Enter R and V for resistor %d: ", i+1);
ReadRes(i,res,vol);
}
return 0;
} // end of main function
int rv (int i, int res, double vol) {
int count = 0;
int n;
while (count <10) {
n = scanf("%d %lf",&res, &vol);
if (n == EOF)
{
printf("No valid resistor value entered\n");
break;
}
else
{
return 1;
}
count ++;
}
}
I'm trying to read in resistor values (array) and use these values to calculate current and power using the basic formulas of ohms law.
the function int rv is used to reading values and i'm also trying to calculate current and power in this function... please help me!!!