C Program printing Celsius-Fahrenheit table

Hi Friends!!

This is the 2nd Program of our Temperature Conversion Table.

This time we converted from Celsius to Fahrenheit using the formula

F = C *(9/5)+32

where

C is Celsius
F is Fahrenheit 

Here is the program

/*Program printing Celsius-Fahrenheit 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 celc;

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

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

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

    

     getch();

     return 0;   

}

Screenshot of the o/p

TemperatureTableCelsiusToFahrenheit


Advertisements

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