/*
========================================================
COMPILATION SUCCESSFUL
Submitted on: 20010511 at: 15:28:49 from: 193.120.70.20
========================================================
*/
//
//Melissa Walsh.
/* Program to convert input data from one temperature measurement system
to another. */
#include
main ()
{
float temp, result;
char source, dest, f, c;
printf ("**************************************************\n");
printf ("* Program to convert one temperature measurement *\n");
printf ("* system to another. *\n");
printf ("**************************************************\n");
printf ("Please enter a temperature a source and a destination character\n");
scanf ("%f%c%c", &temp, &source, &dest);
if(source == 'f' && dest == 'c')
{
printf ("You are converting from fahrenheit to celsius\n");
result = ((temp-32)*5)/9;//Converting using the formula.
printf ("The temperature is %5.1f celsius\n", result);
}
if (source == 'f' && dest == 'f')
{
printf ("No conversion\n");//No conversion therefore no formula required.
printf ("The temperature is %5.1f fahrenheit\n", temp);
}
if (source == 'c' && dest == 'f')
{
printf ("You are converting from celsius to fahrenheit\n");
result = (9*temp)/5+32;//Converting using the formula.
printf ("The temperature is %5.1f fahrenheit\n", result);
}
if (source == 'c' && dest == 'c')
{
printf ("No conversion\n");//No conversion therefore no formula required.
printf ("The temperature is %5.1f celsius\n", temp);
}
}