Hi first time posting. Very new to C coding, currently doing the basics for college. The program is a decimal to rad/degrees to Fahrenheit converter. We had to add to the code to get resistors in series to add together. Just having trouble getting the last bit to work. Any help would be great. Its the last part of the code option 3 im having trouble with.
Temp and Degrees To Rads.c
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int Option, ResCount , Resistors, ResValue, ResTotal;
ResCount = 0;
printf("\t\t_____________________\t\t");
printf("\n\n\tl. Temperature conversion\n");
printf("\t2. Angle conversion\n");
printf("\t3. Series Resistance");
printf("\n\t\nPlease select one of the above options: ");
scanf("%i", & Option);
if (Option == 1) {
float c, f;
do {
printf("Enter Temp between -40 and 60: ");
scanf("%f", & c);
if (c < -40 || c > 60) {
printf("\n\n\t Wrong Value");
}
} while (c < 0 || c > 100);
f = c * 9.0 / 5.0 + 32.0;
printf("Fahrenheit is %.2f", f);
} else if (Option == 2) {
float d, r;
printf("Enter Degrees: ");
scanf("%f", & d);
r = d * 3.14 / 180.0;
printf("Radians is %.2f\n\n", r);
}
else if (Option == 3) {
printf("\n\t\tSeries Resistance\n");
printf("\t\t___________________\n");
printf ("\n\tHow many resisitors do you have?(2-9):\t");
scanf ("%i", &Resistors);
if (Resistors < 2 || Resistors > 9){
printf ("\tEnter a value between 2 and 9\n");
}
while (Resistors <2 || Resistors >9);
for (ResCount=0; ResCount < Resistors; ResCount++){
printf ("\tPlease enter R%i value (Ohms): ", ResCount+1);
scanf("%i", ResValue);
ResTotal = ResTotal + ResValue;
}
printf ("\n\tTotal Resistance is %i Ohms", ResTotal);
}
return 0;
}