Sunday, January 26, 2014

Simple C Program to convert the Celsius value to Fahrenheight value

Simple C Program to convert the Celsius value to Fahrenheight value
#include<stdio.h>
int main()
{
    float celsius,fahrenheit;
    printf("Please enter the celsius temperature:");
    scanf("%f",&celsius);
    fahrenheit=(1.8*celsius)+32;
    printf("\nC=%f",celsius);
    printf("\nF=(1.8*C)+32\n");
    printf("\n(1.8*%f)+32=%f",celsius,fahrenheit);
    printf("\n\nFahrenheit=%f",fahrenheit);
    return 0;
}


Note

Formula is :
F=(9/2*C)+32
For convenience i have written , 9/2= 1.8
F=(1.8*C)+32
The output of above program:

No comments:

Post a Comment