It looks like you have integer division in the second case:
tempC=((5/9)*(tempF-32))
The 5 / 9
will get truncated to zero.
To fix that, you need to make one of them a floating-point type:
tempC=((5./9.)*(tempF-32))
More Related Contents:
- I need assistance in writing the code for bubble sort the array
- Pthreads in C. Simple example doesn’t work [closed]
- Why this code which is posted on howstuffworks.com does not work? [closed]
- Please tell me answer for this code? [closed]
- Can anyone explain me the working of this C code? [duplicate]
- Difficulty with files in a C database [closed]
- C-programming board game [duplicate]
- How to simplify these compound logical expression?
- What is the effect of trailing white space in a scanf() format string?
- Why does a C-Array have a wrong sizeof() value when it’s passed to a function? [duplicate]
- Calculating factorial of large numbers in C
- Why does “++x || ++y && ++z” calculate “++x” first, even though operator “&&” has higher precedence than “||”
- Extracting bits with a single multiplication
- How do we allocate a 2-D array using One malloc statement
- MPI_Bcast a dynamic 2d array
- Why does strcmp() return 0 when its inputs are equal?
- printf specify integer format string for float
- What is a simple and reliable C library for working with Excel files? [closed]
- What are .a and .so files?
- Default values in a C Struct
- How can I work with dynamically-allocated arbitrary-dimensional arrays?
- Is my fma() broken?
- How to use timer in C?
- Why do strings in C need to be null terminated?
- How do I get bit-by-bit data from an integer value in C?
- Android read text file from asset folder using C (ndk)
- Why can’t I pass constant arrays as arguments?
- How to split a string into tokens in C?
- Why doesn’t pressing enter return ‘\n’ to getch()?
- How can I call a function using a function pointer?