I have a problem
I have to convert temperature between farenhiet and celsius.
here is my code
Code:
#include <stdio.h>
int main ()
{
double temp;
int check;
printf("Please enter a fahrenheit temperature ");
check = scanf("%f", &temp);
if (check != 1)
{
printf("Invalid input\n");
return 0;
}
temp = (temp - 32.0) * 5.0 / 9.0;
printf("\nTemperature converted to celsius = %.1f\n", temp);
return 0;
}
my problem is that i get the wrong results. When i enter 5 i should be getting -15.0 but instead i get 1120.0. Can someone help me.