C program to convert fahrenheit temperature into celsius.

 

01  #include <stdio.h>
02
03 float f_to_c(float f);
04 int main()
05 {
06 float ftemp;
07 float ctemp;
08
09 printf("Enter temperature in degrees F : ");
10 scanf("%f", &ftemp);
11 ctemp = f_to_c(ftemp);
12 printf("Temp in degrees F = %3.lfn", ftemp);
13 printf("Temp in degrees C = %3.lfn", ctemp);
14
15 return 0;
16 }
17
18 /* This routine converts degrees F to degrees C */
19 float f_to_c (float f)
20 {
21 return ((f - 32.0) * 5.0/9.0);
22 }
 
OUTPUT

Enter temperature in degrees F : 212
Temp in degrees F = 212
Temp in degrees C = 100

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.