Write a C Program to enter temperature in Fahrenheit and convert to Celsius - Basic C program.



 


Write a C Program to enter temperature in Fahrenheit and convert to Celsius


Objective:

Write a C program to input temperature in degree Fahrenheit and convert it to degree Centigrade. How to convert temperature from Fahrenheit to Celsius in C programming. C program for temperature conversion. Logic to convert temperature from Fahrenheit to Celsius in C program.


Example


Input
Temperature in fahrenheit = 205
Output

Temperature in celsius = 96.11 C


Temperature conversion formula
Formula to convert temperature from degree Fahrenheit to degree Celsius is given by -

ºC = (ºF - 32) * 5/9


Logic to convert temperature from Fahrenheit to Celsius
Step by step descriptive logic to convert temperature from degree Fahrenheit to degree Celsius -

  1. Input temperature in fahrenheit from user. Store it in some variable say fahrenheit.
  2. Apply the temperature conversion formula celsius = (fahrenheit - 32) * 5 / 9.
  3. Print the value of celsius.

%.2f is used to print fractional values only up to two decimal places. You can also use %f to print fractional values normally up to six decimal places.



Solution Code:

//C program to convert temperature from degree fahrenheit to celsius by CodexRitik #include <stdio.h> int 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); return 0; }



Note:

This Code is Verified by CodexRitik.If any error occurs then Comment correct code Below in comment box.

Disclaimer:-

The above hole problem solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.

Write a C Program to enter temperature in Fahrenheit and convert to Celsius - Basic C program. Write a C Program to enter temperature in Fahrenheit and convert to Celsius - Basic C program. Reviewed by CodexRitik on January 03, 2021 Rating: 5

No comments:

Powered by Blogger.