**Write a program in c to convert temperature from degree celsius to fahrenheit**

Write a program in c to convert temperature from fahrenheit to degree celsius

Write a program in c to convert temperature from fahrenheit to degree celsius

Given a temperature in **Celsius**, we have to convert it to **fahrenheit** and print it on screen. To convert **celsius to fahrenheit**, we will use below expression:

**F =(9/5)*C + 32;**

where, C is the temperature in Celsius and F is temperature in Fahrenheit.

## C program to convert temperature from celsius to fahrenheit

/* * C program to convert temperature from celsius to fahrenheit */ #include<stdio.h> #include<conio.h> int main() { float fahren, celsius; printf("Enter the temperature in celsius\n"); scanf("%f", &celsius); /* convert celsius to fahreneheit * Multiply by 9, then divide by 5, then add 32 */ fahren =(9.0/5.0) * celsius + 32; printf("%.2fC is equal to %.2fF\n", celsius, fahren); getch(); return 0; }

**Program Output**

Enter the temperature in celsius 15 15.00C is equal to 59.00F

Enter the temperature in celsius 0 0.00C is equal to 32.00F

## C program to convert temperature from fahrenheit to celsius

In this program, to convert fahreneheit to celsius we are using below expression:

**C = (F - 32)*(5/9);**

where, F is temperature in fahreneheit and C is temperature in celsius.

/* * C program to convert temperature from fahrenheit to celcius */ #include<stdio.h> #include<conio.h> int main() { float fahren, celsius; printf("Enter the temperature in fahrenheit\n"); scanf("%f", &fahren); /* convert fahreneheit to celsius * Subtract 32, then multiply it by 5, then divide by 9 */ celsius = 5 * (fahren - 32) / 9; printf("%.2fF is equal to %.2fC\n", fahren, celsius); getch(); return 0; }

**Program Output**

Enter the temperature in fahrenheit 0 0.00F is equal to -17.78C

Enter the temperature in fahrenheit 98.6 98.60F is equal to 37.00C

**Related Topics**