C program to convert celsius to fahrenheit

Category: C Program

C program to convert celsius to fahrenheit. Write a C program to enter the temperature in celcius and convert it into fahrenheit using operators.

Formula to convert temperature from celcius to fahrenheit

FAHRENHEIT = (CELCIUS * 9 / 5) + 32

And we can use operators to implement the same formula in our C program.

Example -

Input: Enter temperature in Celsius: 10
Output: 10.00 Celsius = 50.00 Fahrenheit

C program to convert celcius to fahrenheit

#include <stdio.h>

void main()
{
    float celsius, fahrenheit;
    printf("Enter temperature in Celsius: ");
    scanf("%f", &celsius);
    fahrenheit = (celsius * 9 / 5) + 32;
    printf("%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
}

Output

Enter temperature in Celsius: 10
10.00 Celsius = 50.00 Fahrenheit

Recommended Posts