Program to convert the given temperature from Fahrenheit(F) to Celsius(C)
Converting the given Temperature from Fahrenheit(F) to Celsius(C) and converting the given temperature from Celsius(C) to Fahrenheit(F): -
_________________________________________
C Program to convert the given temperature from Fahrenheit(F) to Celsius(C): -
The program shown below will temperature value in Fahrenheit(F) from the standard input and converts the temperature into Celsius(C).
Program: -
#include <stdio.h>
void main() {
float f, c;
printf("Enter F: ");
scanf("%f", &f);
c = (f - 32) * 5 / 9;
printf("C = %f\n", c);
}
Output: -
Enter F : 32.45
C : 0.250000
Fig: Program to convert the given temperature from Fahrenheit(F) to Celsius(C) |
Note: -
Formula to convert the temperature in Fahrenheit(F) to Celsius(C)
c = (f - 32) * 5 / 9 and we use, f = (c * 9 /5) + 32 to convert temperature from Celsiuse(C)
to Fahrenheit(F).
_______________________________________________________
C Program to convert the given temperature from Celsius(C) to Fahrenheit(F): -
The program shown below will temperature value in Celsius(C) from the standard input and converts the temperature into Fahrenheit(F).
Program: -
#include <stdio.h>
void main() {
float f, c;
printf("Enter C: ");
scanf("%f", &c);
f = (c * 9/5) + 32;
printf("F = %f\n", f);
}
Output: -
Enter C : 29
F : 84.199997
Fig: Program to convert the given temperature from Celsius(C) to Fahrenheit(F) |
Comments
Post a Comment
Leave your Quires here!