Page

C Program For Convert Temperature in Fahrenheit

#include <stdio.h>
#include <conio.h> 
int main(void)
{

float fahrenheit, celsius;
int lower, upper, step;

lower = 0;
upper = 200;
step = 20;

printf("  F\tC");
printf("\n------------");

fahrenheit = lower;
while(fahrenheit <= upper)
{
celsius = (5.0 / 9.0) * (fahrenheit - 32.0);
printf("\n%3.0f %6.1f", fahrenheit, celsius);
fahrenheit = fahrenheit + step;
}

return 0;
}

No comments:

Post a Comment