Write a C program to enter the temperature in Fahrenheit and convert it to Celsius. Temperature conversion formula [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 📺

Watch tutorial and learn how to solve this problem. 😉

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 it into Celsius.
  3. After conversion, display the result with appropriate message. 😎👍🏻

Flow Chart 🌻

Check how to draw flow chart for this program.

flow charts - Convert temperature from Fahrenheit to Celsius

Code 💻

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

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

Example 😍

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

Temperature in Celcius: 31.11°C

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

Temperature in Celcius: 48.33°C

This is how you can convert temperature from Fahrenheit to Celsius in C programming language. 😇
For more C Programs, click here.

Categorized in: