Write a C program to input temperature in Centigrade and convert to Fahrenheit. How to convert temperature from degree centigrade to degree Fahrenheit in C programming. Logic to convert temperature from Celsius to Fahrenheit in C.

**Example**

**Input**

Enter temperature in Celsius = 100

**Output**

Temperature in Fahrenheit = 212 F

## Required knowledge

Arithmetic operators, Variables and expressions, Data types, Basic input/output

## Temperature conversion formula

Temperature conversion formula from degree Celsius to Fahrenheit is given by -

## Logic to convert temperature from Celsius to Fahrenheit

The logic of temperature conversion exists in converting mathematical formula to C expression. You just need to convert mathematical formula of temperature in C language. Rest is simple input/output.

Below is the step by step descriptive logic to convert temperature from degree Celsius to Fahrenheit.

- Input temperature in Celsius from user. Store it in some variable say
`celsius`. - Apply formula to convert the temperature to Fahrenheit i.e.
`fahrenheit = (celsius * 9 / 5) + 32`

. - Print the value of
`fahrenheit`.

Read more - Program to convert Fahrenheit to Celsius

## Program to convert temperature from Celsius to Fahrenheit

```
/**
* C program to convert temperature from degree celsius to fahrenheit
*/
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
/* Input temperature in celsius */
printf("Enter temperature in Celsius: ");
scanf("%f", &celsius);
/* celsius to fahrenheit conversion formula */
fahrenheit = (celsius * 9 / 5) + 32;
printf("%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
return 0;
}
```

`%.2f`

is used to print fractional numbers up to two decimal places. You can also use `%f`

to print fractional normally up to six decimal places.

Output

Enter temperature in Celsius: 100 100 Celsius = 212.00 Fahrenheit

Happy coding ðŸ˜‰

### Recommended posts

- Basic programming exercises index.
- C program to convert days to years, weeks and days.
- C program to convert length from centimeter to meter and kilometer.
- C program to find diameter, circumference and area of circle.
- C program to calculate power of two numbers x^y.
- C program to perform input/output of basic data types.

doubt, write here. I willhelp my best.<pre><code> ----Your Source Code---- </code></pre>