C program to enter temperature in Fahrenheit and convert to Celsius
// To enter temperature in Fahrenheit and convert to Celsius
#include <stdio.h>
main()
{
float celsius, fahrenheit;
/* Input temperature in fahrenheit */
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &fahrenheit);
/* Fahrenheit to celsius conversion formula */
celsius = (fahrenheit - 32) * 5 / 9;
/* Print the value of celsius */
printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);
}
OUT PUT
Enter temperature in Fahrenheit: 89
89.00 Fahrenheit = 31.67 Celsius
--------------------------------
*****************************************
Related Question
➤Write a C program to convert days into years, weeks and days.
*********************************************
0 Comments