Skip to content
Utopper skill
  • ProgrammingExpand
    • Programming Examples
  • Interview QuestionsExpand
    • DevOps Interview Questions
    • Android Interview Questions
  • How to
  • Tools
  • Top 10
  • Book Summaries
Utopper skill
C Programming Example Programming Examples

C Program To Convert Fahrenheit To Celsius

Article Contents

  1. What are Celsius and Fahrenheit?
  2. What is the approach To Convert Fahrenheit To Celsius in C Programming
  3. Pseudo code to Convert Fahrenheit To Celsius in C Programming
  4. C Program To Convert Fahrenheit To Celsius
  5. Output
C Program To Convert Fahrenheit To Celsius

What are Celsius and Fahrenheit?

Common temperature scales are Celsius and Fahrenheit.

Centigrade is a metric temperature scale. In this scale, water’s freezing point is 0°C and its boiling point is 100°C.

The US and a few other countries use Fahrenheit. In this scale, the freezing point of water is 32 degrees Fahrenheit (°F) and the boiling point is 212 °F.

In the US, Fahrenheit is utilised in daily life, while Celsius is used in science and internationally.

In this article, we will share the detailed C Program To Convert Fahrenheit To Celsius, With Approach, Pseudo Code with Output.

What is the approach To Convert Fahrenheit To Celsius in C Programming

To convert a temperature value in Fahrenheit to Celsius in C, you can follow these steps:

  1. Declare two float variables to hold the Fahrenheit and Celsius temperature values:
float fahrenheit, celsius;

2. Prompt the user to enter a temperature value in Fahrenheit using the printf function:

printf("Enter temperature in Fahrenheit: ");

3. Read the temperature value in Fahrenheit entered by the user using the scanf function:

scanf("%f", &fahrenheit);

4. Convert the Fahrenheit temperature value to Celsius using the following formula:

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

In this formula, fahrenheit is the temperature value in Fahrenheit and celsius is the temperature value in Celsius.

5. Display the converted temperature value in Celsius using the printf function:

printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);

In this printf statement, the %.2f format specifier is used to display the Fahrenheit and Celsius temperature values with two decimal places.

Pseudo code to Convert Fahrenheit To Celsius in C Programming

// Declare variables
float fahrenheit, celsius

// Prompt user to enter temperature in Fahrenheit
Print "Enter temperature in Fahrenheit: "
Read fahrenheit

// Convert Fahrenheit to Celsius
celsius = (fahrenheit - 32) * 5 / 9

// Display the result in Celsius
Print "Temperature in Celsius: "
Print celsius

This program first declares two float variables fahrenheit and celsius. It then prompts the user to enter a temperature in Fahrenheit using the Print and Read statements.

Next, the program performs the conversion calculation from Fahrenheit to Celsius and stores the result in the celsius variable.

C Program To Convert Fahrenheit To Celsius

#include <stdio.h>

int main() {
    float fahrenheit, celsius;
    printf("Enter temperature in Fahrenheit: ");
    scanf("%f", &fahrenheit);

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

    printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);
    return 0;
}
  • This program first declares two float variables: fahrenheit and celsius. Then, it prompts the user to enter a temperature in Fahrenheit using the printf and scanf functions.
  • Next, the program performs the conversion calculation from Fahrenheit to Celsius and stores the result in the celsius variable.
  • Finally, the program prints out the original Fahrenheit temperature and the converted Celsius temperature using the printf function with formatting specifiers to display two decimal places.

Note : The conversion formula used in this program is (F - 32) * 5/9, where F is the temperature in Fahrenheit. This formula converts a Fahrenheit temperature to its Celsius equivalent.

Output

Enter temperature in Fahrenheit: 68
68.00 Fahrenheit = 20.00 Celsius
  • In this program, the user is prompted to enter a temperature value in Fahrenheit. The program then reads this input using the scanf function and stores it in the fahrenheit variable.
  • The program then converts the temperature value in Fahrenheit to Celsius using the formula celsius = (fahrenheit - 32) * 5 / 9, and stores the result in the celsius variable.
  • Finally, the program uses the printf function to display the converted temperature value in Celsius with two decimal places. The output shows the original temperature value in Fahrenheit and the corresponding temperature value in Celsius.
Post Tags: #c program#Fahrenheit To Celsius c program
Avatar photo
Utopper Skill Team
Facebook X Instagram YouTube Linkedin Pinterest

Post navigation

Previous Previous
Book Summary of The One Thing By Gary Keller and Jay Papasan
NextContinue
Book Summary of Indistractable By Nir Eyal

Latest Interview Questions

  • C++ Program To Print Prime Numbers From 1 To N
  • C Program to Print Your Own Name with Example
  • Book Summary of Why We Sleep By Matthew Walker
  • Book Summary of Indistractable By Nir Eyal
  • C Program To Convert Fahrenheit To Celsius
  • Book Summary of The One Thing By Gary Keller and Jay Papasan
  • Facebook
  • Instagram
  • YouTube
  • Telegram
  • LinkedIn
  • Twitter

Mail : [email protected]

Privacy Policy | DISCLAIMER | Contact Us

Learn Development

learn HTML

learn CSS

learn JavaScript

Examples

C Examples

C++ Examples

Java Examples

Study Material

Interview Questions

How to

Hosting

SEO

Blogging

© 2023 Utopper.com

All Rights Reserved with Copyright & Registered TradeMarks
OWNED BY : GROWTH EDUCATION SOLUTIONS PRIVATE LIMITED

Scroll to top
  • Programming
    • Programming Examples
  • Interview Questions
    • DevOps Interview Questions
    • Android Interview Questions
  • How to
  • Tools
  • Top 10
  • Book Summaries
Search