C program to convert Celsius to Fahrenheit

Simple-C-Program

In this article, we are going to learn the C program to convert Celsius to Fahrenheit . This program will help you to enter the temperature in celsius and then convert it to Fahrenheit.

The formula that we are going to use in this program is:

fahrenheit = (celsius * 9 / 5) + 32

Where

  • Fahrenheit – This is the temperature in Fahrenheit which we will get after conversion.
  • celsius – This is the temperature in celsius degree which the user will enter to do the conversion.

Using this simple formula, we will perform the calculation with C language logic and syntaxes. We will take input from the user in celsius degrees, then perform the logic as per the above formula. Finally, display the calculated results. so let us see this in action in the C language program below.

C program to convert Celsius to Fahrenheit


#include <stdio.h>

int main()
{
    float celsius, fahrenheit;

    printf("Please enter the temperature in Celsius to Convert it to Fahrenheit : ");
    scanf("%f", &celsius);

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

    printf("The Temprature %.2f Celsius is Equal to %.2f in Fahrenheits", celsius, fahrenheit);

    return 0;
}

Output

Please enter the temperature in Celsius to Convert it to Fahrenheit : 34
The Temprature 34.00 Celsius is Equal to 93.20 in Fahrenheits