prev | Assigned Values For Variables 6.Conversion from Fahrenheit to Centigrade (21.6.2009) /* Program# 6 date : 10-12-2008 Fahrenheit to centigrade */ #include <stdio.h> main(){ float c,f; f=215.0; c=(5.0/9.0)*(f-32); printf("215.0 f equals : %.1f celsius\n",c); } output: 215.0 f equals : 101.7 celsius Things to note: (f-32) will result in float.Because the integer value 32 is promoted to float as 32.0 and therefore the result is float. |
next |