#include <stdio.h>
int main()
{
float c = 5.0;
printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32);
return 0;
}
            Asked
            
        
        
            Active
            
        
            Viewed 56 times
        
    -4
            
            
         
    
    
        Suraj Rao
        
- 29,388
- 11
- 94
- 103
- 
                    Abhiraj Das, Curious. Why code `float c = 5.0;` instead of `double c = 5.0;`? – chux - Reinstate Monica Nov 13 '21 at 14:02
- 
                    1`9 * c / 5` would avoid the integer division. – Weather Vane Nov 13 '21 at 14:04
- 
                    Stack Overflow should automatically mark any question containing “Fahrenheit”, “Celsius”, ”centigrade”, or “temperature” and “9” and “5” as a suggested duplicate of one of the million others. – Eric Postpischil Nov 13 '21 at 14:23
1 Answers
2
            
            
        Change your statement to (9.0/5.0)*c + 32 as 9 and 5 are integers, their division returns integer that is 1. So write them in float variable format.
 
    
    
        user438383
        
- 5,716
- 8
- 28
- 43
 
    
    
        Giriteja Bille
        
- 168
- 1
- 13
