Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Temp conversion with c useing dev++

Options
  • 30-09-2016 10:55pm
    #1
    Registered Users Posts: 35


    Hi,

    I am learning c, new to programing, any help with following would be much appreciated. Keeps giving me the answer 0.000000000:mad::mad::mad:

    *****************************************************
    #include <stdio.h>

    int main()

    {

    //declarations
    float celsius=0;
    float fahrenheit=0;


    printf("please enter a tempture in fahrenhiet \n");
    printf("-->number must be from -500 to 1000 \n\n");
    printf("****range is from -500 to 1000****\n");
    scanf("%f", &fahrenheit);


    if((fahrenheit<-500)||(fahrenheit>1000))
    printf("invlid number range\n\a");

    else {
    celsius = faherheit -32 (5.0/9.0) *5 ;
    printf("\nThe answer in celcius is ---->> %f", &celsius);
    }
    return 0;
    }
    *****************************************************


Comments

  • Registered Users Posts: 2,426 ✭✭✭ressem


    4 errors in this line
    celsius = faherheit -32 (5.0/9.0) *5 ;

    1 spelling error, and 3 errors in the conversion formula.

    If fahrenheit is 212 then celsius should be 100.

    Really important for a starter programmer to learn how to use the debug, breakpoint, step and inspect variable.

    Loads of videos on youtube using dev c++. This one is less than 3 minutes.
    https://www.youtube.com/watch?v=Jq1WTkOlk3w


  • Registered Users Posts: 35 techintraining


    Thank's :)


Advertisement