+ Reply to Thread
Results 1 to 3 of 3

Thread: Correct this statement

  1. #1
    TopGun Guest

    Correct this statement

    What is wrong with the code? The code was for conversion from Celsius to Fahrenheit
    degF =5/9*(degC+32)

  2. #2
    TopGun Guest

    Re: Correct this statement

    degF = (9/5)*degC + 32;

    or

    degC = (5/9)*(degF-32)

  3. #3
    ramaswamy.be Guest

    Re: Correct this statement

    degF =5/9*(degC+32)
    In the above statement 5 and 9 are integer so, so it is doing the integer division,
    so you may end the with the result 5/9 =0. So whole result is 0
    Solution is convert any number to float
    degF =5.0/9*(degC+32) or degF =5/9.0*(degC+32)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts