Convert Fahrenheit to Celsius using C Program

CServer Side ProgrammingProgramming

The logic that we implement to convert Fahrenheit to Celsius is as follows −

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

Algorithm

Refer to the algorithm given below to convert Fahrenheit to Celsius.

Step 1: Declare two variables farh, cels
Step 2: Enter Fahrenheit value at run time
Step 3: Apply formula to convert
        Cels=(farh-32)*5/9;
Step 4: Print cels

Example

Following is the C program to convert Fahrenheit to Celsius −

 Live Demo

#include<stdio.h>
int main(){
   float fahrenheit, celsius;
   //get the limit of fibonacci series
   printf("Enter Fahrenheit: \n");
   scanf("%f",&fahrenheit);
   celsius = (fahrenheit - 32)*5/9;
   printf("Celsius: %f \n", celsius);
   return 0;
}

Output

When the above program is executed, it produces the following result −

Enter Fahrenheit:

100
Celsius: 37.777779
raja
Published on 08-Mar-2021 09:54:38
Advertisements