Conversion of Fahrenheit to Celsius and vice versa
Program:
Fahrenheit to Celsius Conversion:
#include <stdio.h>
int main() {
float fahrenheit, celsius;
// Input temperature in Fahrenheit
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &fahrenheit);
// Convert Fahrenheit to Celsius
celsius = (fahrenheit - 32) * 5 / 9;
// Display the result
printf("%.2f Fahrenheit = %.2f Celsius\n", fahrenheit, celsius);
return 0;
}


No comments:
Post a Comment