Pages

This blog is under construction

Thursday, December 20, 2018

C program to convert the temperature (a) from Celsius to Fahrenheit and (b) from Fahrenheit to Celsius.

Relationship between Celsius and Fahrenheit is governed by the formula
F = (9C/5)+32

#include<stdio.h>
void main()
{
float F,C;
C=200;
F=(((9*C)/5)+32);
printf("Celsius = %f to Fahrenheit = %f\n",C,F);
F=300;
C=((F-32)*5)/9;
printf("Fahrenheit = %f to Celsius = %f\n",F,C);
}
Celsius = 200.000000 to Fahrenheit = 392.000000                                                                                                      
Fahrenheit = 300.000000 to Celsius = 148.888885 

No comments:

Post a Comment