C Program to convert temperature from fahrenheit to celsius

C Programming Language / Fundamentals of C Language

2378

Program:

 /**
 * C program to convert temperature from degree fahrenheit to celsius
 */

#include"stdio.h"

int main()
{
    float celsius, fahrenheit;

    // Reads temperature in fahrenheit
    printf("Enter temperature in Fahrenheit: ");
    scanf("%f", &fahrenheit);

    // Fahrenheit to celsius conversion formula
    celsius = (fahrenheit - 32) * 5 / 9;

    // Print the result
    printf("%.2f Fahrenheit = %.2f Celsius \n", fahrenheit, celsius);

    return 0;
}

Output:

Enter temperature in Fahrenheit: -40
-40.00 Fahrenheit = -40.00 Celsius
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.