You could use a combination of fgets() and sscanf().
Code:
#include <stdio.h>
int main(void)
{
char s[20];
int fields_scanned;
float cent, fahr;
do {
printf("Enter fehrenheit to be converted centigrade: ");
fgets(s,20,stdin);
fields_scanned = sscanf(s,"%f", &fahr);
} while (fields_scanned == 0);
cent = (5.0/9.0) * (fahr-32.0);
printf("\n%3.0f fehrenheit = %6.1f centigrade\n", fahr, cent);
if (cent > 38)
{
printf("Dangerously high temperature level\n");
}
else if (cent < 35)
{
printf("Temperature is very low, Hypothermia alert!\n");
}
else
{
printf("Temperature level not dangerous, but monitor closely\n");
}
return 0;
}