C Program to Convert Celsius to Fahrenheit
Introduction
The logic of temperature conversion is converting mathematical formula to C expression. we can just convert mathematical formula of temperature in C language. Rest is simple input/output.
Formula
Fahrenheit = (9/5) * Celsius) + 32
Program
//C program to convert Celsius to Fahrenheit
#include <stdio.h>
#include <conio.h>
int main()
{
float celsius, fahrenheit;
printf("Please Enter temperature in Celsius: \n");
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);
getch();
return 0;
}
Output
0 Comments
Blog
Active User (0)
No Active User!