# C Program to Convert Fahrenheit to Celsius vise-versa

## Introduction

The C programming language is a procedural programming language. Between 1969 and 1973, Dennis Ritchie worked on the project. It was created primarily as a system programming language for developing operating systems. Low-level memory access, a small collection of keywords, and a clean style are all qualities that make C language excellent for system programming, such as operating system or compiler development.

## Why Learn C Programming Language?

Because it mixes the characteristics of high-level languages with the functionalism of assembly language, C is often referred to as a middle-level computer language. The manipulation of bits, bytes, and addresses in C gives the programmer more control over how the program will behave and more direct access to the underlying hardware mechanisms.

Working programmers influenced, influenced, and field-tested C. As a result, C provides the programmer with exactly what he or she want. C++ is a more advanced version of the C programming language. C++ incorporates all of the features of C, as well as support for object-oriented programming (OOP). Furthermore, C++ includes numerous enhancements and features that make it a “better C,” regardless of whether or not it is used for object-oriented programming.

## Fahrenheit and Celsius

The Fahrenheit temperature scale is named after German physicist Daniel Gabriel Fahrenheit and is used in the United States (and its associated territories) and some Caribbean countries to measure temperature. Water freezes at 32°F and boils at 212°F on the Fahrenheit scale (at sea level).

The Celsius temperature scale, which was first known as centigrade before being renamed after Swedish astronomer Anders Celsius, is used practically everywhere else in the world. Water freezes at 0°C and boils at 100°C on the Celsius scale (at sea level).

## Fahrenheit and Celsius Conversation

You want to convert from Celsius to Fahrenheit. While you’ll give your answer in degrees Celsius or degrees Fahrenheit, you should be aware that the temperature scales are Celsius and Fahrenheit. This isn’t important for your final response, but it’s useful to know if you’re ever asked to spell out the names. It’s really simple to convert:

Multiply the temperature in degrees Celsius by 1.8. To this value, add 32. This is the temperature in degrees Fahrenheit.

°F = (°C × 9/5) + 32

Converting Fahrenheit to Celsius is just as simple.

°C = (°F − 32) x 5/9

The best way to learn is to do. Hence, what better way to learn C programming language (if you know the basics) than to code your first mini project. In this tutorial we are going to build a program for conversion of Fahrenheit to Celsius and conversion of Celsius to Fahrenheit using c programming language. Keep in mind this is a mini project for absolute beginners and intermediate programmers as well.

// C Program to convert temperature from Fahrenheit to Celsius and vice versa

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

int main()
{
float fh,cl;
int choice;
printf("\n1: Convert temperature from Fahrenheit to Celsius.");
printf("\n2: Convert temperature from Celsius to Fahrenheit.");
// Giving the users the option to chooose
printf("\nEnter your choice (1, 2): ");
scanf("%d",&choice);
// Converting Fahrenheit to Celsius
if(choice ==1){
printf("\nEnter temperature in Fahrenheit: ");
scanf("%f",&fh);
cl= (fh - 32) / 1.8;
printf("Temperature in Celsius: %.2f",cl);
}
// Converting Celsius to Fahrenheit
else if(choice==2){
printf("\nEnter temperature in Celsius: ");
scanf("%f",&cl);
fh= (cl*1.8)+32;
printf("Temperature in Fahrenheit: %.2f",fh);
}
else{
printf("\nInvalid Choice !!!");
}
return 0;
}


## Output

• Output for Conversion of Fahrenheit to Celsius 1 :
• Output for Conversion of Fahrenheit to Celsius 2 :
• Output for Conversion of Celsius to Fahrenheit 1 :
• Output for Conversion of Celsius to Fahrenheit 2 :
SHARE C Program to Convert Fahrenheit to Celsius vise-versa