Home C Language Basic C Programs Fahrenheit to Celsius

Fahrenheit to Celsius

Write a C Program to convert Fahrenheit to Celsius.

#include<stdio.h>

int main()

{

   float C,F; // ‘C’ for Celsius,’F’ for Fahrenheit

   printf(“Enter Fahrenheit temperature : “);

   scanf(“%f”,&F); //Reading Fahrenheit temperature

   C=(5/9.0)*(F-32); //Converting Fahrenheit temperature to Celsius by predefined formula.

   printf(“Celsius temperature is : %.2f”,C);

   return 0;

}

Output:

i) Enter Fahrenheit temperature : 60

Celsius temperature is : 15.56

ii) Enter Fahrenheit temperature : 32

Celsius temperature is : 0.00

For improvement of your coding skills we give some tasks along this. If you solve this tasks and send to our email (onlineexamshubteam@gmail.com) with your details. We will display your details(like Name, City, college, photo) in our site.

Task: Write a c program to convert Miles to Kilometers.