Write a program to demonstrate Temperature Conversion Problem

The program presented converts the given temperature in Fahrenheit to Celsius using the following conversion formula:


F - 32
C = ----------------
1.8

#include "stdio.h"
#define F_LOW 0
#define F_MAX 250
#define STEP 25
main()
{
typedef float REAL;
REAL fahrenheit, celsius;
fahrenheit = F_LOW;
printf("Fahrenheit Celsius\n\n");
while( fahrenheit <= F_MAX )
{
celsius = ( fahrenheit - 32.0)/1.8;
printf("%5.1f %7.2f\n", fahrenheit, celsius);
fahrenheit = fahrenheit + STEP;
}
return 0;
}

Output:

Fahrenheit Celsius

0.0 -17.78
25.0 -3.89
50.0 10.00
75.0 23.89
100.0 37.78
125.0 51.67
150.0 65.56
175.0 79.44
200.0 93.33
225.0 107.22
250.0 121.11


0 comments:

Post a Comment

 

About Me

It's Me!Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.

Site Info

ProjectCSharp.com is mainly about demonstrating real time examples in different technologies like ASP.NET, WCF, WPF, Silverlight, Azure etc..,

Followers

Help Links

Project CSharp (C#) Copyright © 2011. All Rights Reserved.