by Dinesh Thakur Category: C Programming (Pratical)

In this program user convert the temperature from Fahrenheit to Celsius. User declares required variables for containing the value in it. User declares the value to variables manually to make process of temperature conversion. Then while condition for laying the condition complete. In while condition the method is been used for temperature conversion that are required. Then a printing method to print result on the screen.

Problem Statement:

  1. Declaring variable.
  2. Using condition as required.
  3. Using conversion method.
  4. Display result on screen

Method for Converting Fahrenheit to Celsius.

“ Celsius = (5.0 / 9.0) * (fahr - 32.0);”

Here is C source code for Converting temperature from Fahrenheit to Celsius. The output of this program shown below. 

#include <stdio.h>

int main(void)
{
      float fahr, celsius;
      int lower, upper, step;
      clrscr();
      lower = 0;
      upper = 300;
      step = 20;
      printf("F       C\n\n");
      fahr = lower;
      while(fahr <= upper)
             {
                  celsius = (5.0 / 9.0) * (fahr - 32.0);
                  printf("%3.0f %6.1f\n", fahr, celsius);
                  fahr = fahr + step;
             }
                  getch();
                  return 0;

Fahrenheit to Celsius

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content