CDeveloperHow-To

C Program to convert temperature

By Oct 19, 2014 No Comments

It’s been a while since I posted another C program. My previous program was How toConvert km to m,feet,inch and cm in C. This is a C program to convert temperature from Fahrenheit to Centigrade. This is the 4th question of section I of the first chapter: Getting Started of the book, “Let us C” by “Yashwant Kanetkar”. I would really like if you post a thank you in the comments. If you have any doubts, requests or suggestions, feel free to use our comments section. Do share it with your friends and fellow learners as it maybe helpful for them.

Question:

Temperature of a city in Fahrenheit degrees is input through keyboard. Write a program to convert temperature into centigrade degrees.

Solution: C program to convert temperature

First we to accept the temperature and store it into float datatype. The formula (f – 32) / 1.8 is used to convert temperature from Fahrenheit to centigrade. The value obtained from the formula is stored in another float variable and then the result is displayed. This is a very simple program and can be done in minutes.

Download here:

Download Program

Source Code: C program to convert temperature

#include<stdio.h>
#include<conio.h>
void main()
{
float f, c;
clrscr();
printf("Enter temperature in Fahrenheit: ");
scanf("%f", &f);
c= (f - 32) / 1.8;
printf("Result in centigrade : %f",c);
getch();
}

Output:

Enter temperature in Fahrenheit: 43

Result in centigrade : 6.111111

Download C program to convert temperature here:

Download Program

See Also:

Introduction to C Programming

Adding two numbers in C

Subtracting two numbers in C

Convert km to m,feet,inch and cm in C

Harsh Shah

Harsh Shah

Geek, Tech Crazy, Wannabe Entrepreneur, Blogger, Freelancer, Noob

Leave a Reply