Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Temp conversion with c useing dev++

  • 30-09-2016 10:55PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2, Paid Member Posts: 2,427 ✭✭✭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, Registered Users 2 Posts: 35 techintraining


    Thank's :)


Advertisement