Thursday, January 20, 2011

Constants, Variables and Data Types

The program to converts the given temprature in fahrenheit to celsius using the following conversion formula.
C = (F-32)/1.8
#include<stdio.h>
#define F_LOW 0
#define F_MAX 250
#define STEP 25
void 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;
}
getch();
}

No comments:

Post a Comment