Okay, so I am REALLY new to C, and have been stumped for over 6 hours on this realy (seemingly) basic
if...else program. Here's the whole shebang:
#include <stdio.h>
#include <math.h>
/*
* This program will classify varying resistances
* according to its inputed value,
* and utilize input validation for negative values.
*/
int main(void)
{
double resist;
printf ("Please enter a value for resistance: ");
scanf ("lf", &resist);
if (resist > 1000000) {
printf ("That resistance is in MEGA-ohms!\n");
}
else if (resist >= 1000) { /* This will determine kilo-ohms */
printf ("That resistance is in kilo-ohms.\n");
}
else if (resist >= 1) { /* This will determine "base-line" ohms */
printf ("That resistance is in ohms.\n");
}
else if (resist < 1) { /* This will determine if milli-ohms */
printf ("That resistance is milli-ohms.\n");
}
else if (resist <= 0) { /* This will be input validation for zero or a negative value */
printf ("You must enter a value greater than zero!\n");
}
return (0);
}