Write a C program to input temperature in Fahrenheit and convert to Centigrade . How to convert
temperature from degree centigrade to degree Fahrenheit in C programming. Logic to convert
temperature from Celsius to Fahrenheit in C.
temperature from degree centigrade to degree Fahrenheit in C programming. Logic to convert
temperature from Celsius to Fahrenheit in C.
- #include<stdio.h>
- void main()
- {
- float celsius,fahrenheit;
- // Reads temperature in fahrenheit
- printf("\nEnter temperature in Fahrenheit:");
- scanf("%f",&fahrenheit);
- // Fahrenheit to celsius conversion formula
- celsius=(fahrenheit - 32)*5/9;
- // Print the result
- printf("\nCelsius = %.3f",celsius);
- //.3f means correct to 3 decimal places
- return 0;
- }
- #include<stdio.h>
- int main()
- {
- float c,F;
- printf("Enter temperature in Centigrade:\n");
- scanf("%f",&c);
- F =(c* 1.8) +32;
- printf("Fahrenheit: = %.2f",F);
- return 0;
- }
OUTPUT