A simple program to show you how to create a table of Fahrenheit and Celsius values using a for loop. You may be able to learn from this code.
Convert Fahrenheit to Celsius
/* create a table of Fahrenheit/Celcius values */
#include <stdio.h>
int main()
{
int fahr;
printf( "Fahr\t Celsius\n" );
for ( fahr = 300; fahr >= 0; fahr = fahr - 10 )
{
printf( "%3d \t%6.1f\n", fahr, (5.0/9.0) * (fahr-32.0) );
}
getchar(); /* wait for key */
return 0;
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.