C Program printing Fahrenheit-Celsius table

Hi Friends!!

This is a C Program Printing Fahrenheit-Celsius table

Here we have converted from  Fahrenheit to Celsius using the formula

C = (5/9)*(F-32)

where

C is Celsius
F is Fahrenheit 


/*Program printing Fahrenheit-Celsius table*/

#include <stdio.h>

#include <conio.h>

#define LOWER 0 /* lower limit of table */

#define UPPER 200 /* upper limit */

#define STEP 10 /* step size */

 

int main()

{

    int fahr;

    printf(” Fahrenheit \t Celsius\n\n “);

    for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP)

    printf(” %d \t   %6.1f\n”, fahr, (5.0/9.0)*(fahr-32));

 

    getch();

    return 0;  

}

Snapshot of the output

TemperatureTableInC

Advertisements

2 thoughts on “C Program printing Fahrenheit-Celsius table

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s