Utopper SkillUtopper Skill
  • Programming
    • Programming Examples
  • Interview Questions
    • DevOps Interview Questions
    • Android Interview Questions
  • How to
  • Tools
  • Top 10
  • Book Summaries
Reading: C Program To Convert Fahrenheit To Celsius
Share
Utopper SkillUtopper Skill
Search
  • Book Summaries
  • Programming Examples
  • C Programming Example
  • Interview Question
  • How to
  • Top 10
Follow US
Utopper Skill > Programming Examples > C Programming Example > C Program To Convert Fahrenheit To Celsius
C Programming ExampleProgramming Examples

C Program To Convert Fahrenheit To Celsius

Utopper Skill Team
By Utopper Skill Team Last updated: March 9, 2024
Share
5 Min Read
C Program To Convert Fahrenheit To Celsius
SHARE
Table of Content
What are Celsius and Fahrenheit?What is the approach To Convert Fahrenheit To Celsius in C ProgrammingPseudo code to Convert Fahrenheit To Celsius in C ProgrammingC Program To Convert Fahrenheit To CelsiusOutput

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.
TAGGED:c programFahrenheit To Celsius c program
Share This Article
Facebook Twitter Whatsapp Whatsapp Telegram Copy Link Print
Previous Article Book Summary of The One Thing By Gary Keller and Jay Papasan Book Summary of The One Thing By Gary Keller and Jay Papasan
Next Article Book Summary of Indistractable By Nir Eyal Book Summary of Indistractable By Nir Eyal
Most Popular
Learn C Programming (Basic to Advanced)
Basics of Pointers in C
Utopper Skill Author By Utopper Skill Author
Learn C Programming (Basic to Advanced)
ftell() in C Programming
Utopper Skill Author By Utopper Skill Author
DevOps Interview Questions
30+ Basic DevOps Interview Questions
Utopper Skill Team By Utopper Skill Team
Learn C Programming (Basic to Advanced)
fseek() in C
Utopper Skill Author By Utopper Skill Author
Learn C Programming (Basic to Advanced)
Goto Statement in C
Utopper Skill Author By Utopper Skill Author

You Might Also Like

C++ Program To Print Prime Numbers From 1 To N
C Programming ExampleProgramming Examples

C++ Program To Print Prime Numbers From 1 To N

11 Min Read
C Program to Print Your Own Name
Programming ExamplesC Programming Example

C Program to Print Your Own Name with Example

2 Min Read
C Program To Find LCM of Two Numbers
Programming ExamplesC Programming Example

C Program To Find LCM of Two Numbers

6 Min Read
C++ Program To Add Two Complex Numbers
Programming ExamplesC++ Programming Example

C++ Program To Add Two Complex Numbers

8 Min Read

Mail : [email protected]

Privacy Policy | DISCLAIMER | Contact Us

Learn

  • learn HTML
  • learn CSS
  • learn JavaScript

Examples

  • C Examples
  • C++ Examples
  • Java Examples

Study Material

  • Interview Questions
  • How to
  • Hosting
  • SEO
  • Blogging

 

© 2024 : UTOPPER.COM | Owned By : GROWTH EDUCATION SOLUTIONS PRIVATE LIMITED
Welcome Back!

Sign in to your account

Lost your password?