Fahrenheit to degree Celsius conversion by C programming.

Q. Write a C program to convert degree Fahrenheit to degree Celsius:

Ans:

 #include <stdio.h>


int main() {

    float fahrenheit, celsius;

    

    printf("Enter temperature in Fahrenheit: ");

    scanf("%f", &fahrenheit);

    

    // Convert Fahrenheit to Celsius using the formula (F - 32) * 5/9

    celsius = (fahrenheit - 32) * 5 / 9;

    

    printf("%.2f Fahrenheit is equal to %.2f Celsius.\n", fahrenheit, celsius);

    

    return 0;

}



Comments