1, indentation really helps to see what's going on.
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;
}
2, compile with lots of warnings enabled.
Code:
$ gcc -Wall -Wextra foo.c
foo.c: In function ‘main’:
foo.c:46:13: warning: format ‘%i’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=]
scanf("%i", ResValue);
^
foo.c:46:7: warning: ‘ResValue’ may be used uninitialized in this function [-Wmaybe-uninitialized]
scanf("%i", ResValue);
^
In this case, you forgot an & on one of your scanf's.