I'm trying to change fahrenheit to Kelvin anf the formula is K = 5/9 (° F - 32) + 273  
My code is:
#include <stdio.h>
double const changeToC = 32.0;
double const changeToK = 273.16;
void temperatures(double n);
int main(void)
{
    int q = 'q';
    double userNumber;
    printf("please enter fahrenheit number: \n");
    scanf("%f", &userNumber);
    while (userNumber != q)
    {
        temperatures(userNumber);
        printf("\n");
        printf("please enter fahrenheit number: \n");
        scanf("%f", &userNumber);
    }
}
void temperatures(double n)
{
    double celsius, kelvin;
    celsius = 5.0 / 9.0 * (n - changeToC);
    kelvin = 5.0 / 9.0 (n - changeToC) + changeToK;
    printf("fahrenheit is: %.2f - celsius is: %.2f - kelvin is: %.2f", 
           n, celsius, kelvin);
}
I need the input to get a fahrenheit in double, and print the value of celsius and kelvin.
In the fahrenheit to kelvin(kelvin = 5.0 / 9.0 (n - changeToC) + changeToK;) line I'm getting an error: 
called object type double is not function or function pointer
Can you please tell me what this means?
F° to C°: Fahrenheit to Celsius Conversion Formula To convert temperatures in degrees Fahrenheit to Celsius, subtract 32 and multiply by . 5556 (or 5/9).
How do you convert Celsius to Kelvin formula? The conversion of Celsius to Kelvin: Kelvin = Celsius + 273.15.
You missed the multiplication operator, *
kelvin = 5.0 / 9.0 * (n - changeToC) + changeToK;
Without the multiplication operator, the compiler treats the parentheses () as the function call operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With