C program to convert Celsius to Fahrenheit; Through this tutorial, we will learn how to convert celsius to Fahrenheit in c program.
Algorithm to Convert Celsius to Fahrenheit
Use the following algorithm to write a program to convert Celsius to Fahrenheit; as follows:
- Start program.
- Take an input celsius and store into a variable.
- Convert to celsius to fahrenheit.
- Print fahrenheit.
- Stop program.
C Program to Convert Celsius to Fahrenheit
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
printf("Please Enter temperature in Celsius: :- ");
scanf("%f", &celsius);
// Convert the temperature from celsius to fahrenheit
fahrenheit = ((celsius * 9)/5) + 32;
// fahrenheit = ((9/5) * celsius) + 32;
// fahrenheit = ((1.8 * celsius) + 32;
printf("\n %.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
return 0;
}
The output of the above c program; as follows:
Please Enter temperature in Celsius: :- 100
100.00 Celsius = 212.00 Fahrenheit