Write a program to enter the temperature in Fahrenheit and convert it to Celsius. [C = ((F – 32) * 5) / 9]

Since, the temperature conversion formula is given in the problem statement which makes it one of the easiest programs in C language.

Tutorial 📺

Steps 🪜

Convert Temperature from Fahrenheit to Celsius

  1. Accept temperature in Fahrenheit from the user and store it in a variable called F.
  2. Use the given formula C = ((F - 32) * 5) / 9 to convert the accepted value from Fahrenheit to Celsius.
  3. After temperature conversion, display the result with appropriate message.

Flow Chart 🌻

Check how to draw the flow chart for this program.

Code 💻

#include <stdio.h>
#include <conio.h>

int main()
{
  float F, C;
  printf("Please enter the temperature in Fahrenheit: ");
  scanf("%f", &F);
  C = ((F - 32) * 5) / 9; // Formula to convert Fahrenheit to Celsius
  printf("\n\nTemperature in Celcius: %0.2f%c", C, 248);
  return 0;
}

Example 😍

Let’s assume that the user enters 88 as temperature in Fahrenheit. This value will be converted into Celsius and the output will be like:

Temperature in Celsius: 31.11°C

Let’s take another example where the user enters 119 as temperature in Fahrenheit. The output will be like this:

Temperature in Celsius: 48.33°C

This is how we Convert Temperature from Fahrenheit to Celsius. For more C Programs, click here.


Categorized in: