This code is functioning almost perfectly but it seems to be ignoring my if else statements. The goal of this program is to only convert temperatures between -100 and 100 but for some reason my code is still converting any number that is entered. It is frustrating because I have tried several different approaches but the program never goes to the else statement and always runs the if statement even if say I entered 10000. Thank you any advice would be appreciated
double converter()
{
float C, F, S;
int input;
printf ("Please enter a temperature in Fahrenheit:");
scanf ("%f", &F);
if (F > -100 || F < 100) {
C = FCR * (F -32);
printf ("%f F ==> %f C ", F, C);
printf ("%f", F);
}
else {
F = pow(C, 3);
printf ("Invalid Fahrenheit temperature.");
}
}
Aucun commentaire:
Enregistrer un commentaire