answersLogoWhite

0

Code Example:/********************************************************************************* MODULE: main.c******************************************************************************** DESCRIPTION:* Program that takes a temperature from the user on the command line, then* displays that temperature as celsius converted to Fahrenheit, and* as Fahrenheit converted to celsius.********************************************************************************/#include #define iARGS_REQUIRED 2#define iARG_EXE 0#define iARG_INPUT 1static floatfCelsiusToFahrenheit( float fCelsius );static floatfFahrenheitToCelsius( float fFahrenheit );/********************************************************************************* MAIN********************************************************************************/intmain( int iArgc, char *acpArgv[] ){ float fFahrenheit = 0.0; float fCelsius = 0.0; float fInput = 0.0; /* user didn't provide a temperature on the command line */ if(iArgc != iARGS_REQUIRED) { fprintf(stderr, "Usage: %s [temperature]\n", acpArgv[iARG_EXE]); return 0; } /* read the given temperature into the fInput variable */ sscanf(acpArgv[iARG_INPUT], "%f", &fInput); /* fInput treated as celsius and converted to Fahrenheit */ fFahrenheit = fCelsiusToFahrenheit(fInput); /* fInput treated as Fahrenheit and converted to celsius */ fCelsius = fFahrenheitToCelsius(fInput); printf( "%.2f degrees Fahrenheit is %.2f degrees celsius.\n", fInput, fCelsius ); printf( "%.2f degrees celsius is %.2f degrees Fahrenheit.\n", fInput, fFahrenheit ); return 0;}/********************************************************************************* STATIC FUNCTION: fCelsiusToFahrenheit******************************************************************************** DESCRIPTION:* Converts a celsius temperature to Fahrenheit.** PARAMETERS:* fCelsius: The temperature in celsius to convert.** RETURNS:* fCelsius converted to Fahrenheit.********************************************************************************/static floatfCelsiusToFahrenheit( float fCelsius ){ return (fCelsius * 1.8) + 32;}/********************************************************************************* STATIC FUNCTION: fFahrenheitToCelsius******************************************************************************** DESCRIPTION:* Converts a Fahrenheit temperature to celsius.** PARAMETERS:* fFahrenheit: The temperature in Fahrenheit to convert.** RETURNS:* fFahrenheit converted to celsius.********************************************************************************/static floatfFahrenheitToCelsius( float fFahrenheit ){ return (fFahrenheit - 32) / 1.8;}
User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

Why is it fifty degrees hotter on a Celsius scale?

That's wrong. That's not how you convert temperatures between Celsius and Fahrenheit.


How do you convert 50c to Fahrenheit?

To convert Celsius temperatures into Fahrenheit:Begin by multiplying the Celsius temperature by 9.Divide the answer by 5.Now add 32.122 Degrees Fahrenheit.


To convert Celsius temperatures to Fahrenheit temperatures quickly without?

You can quickly estimate Fahrenheit temperatures from Celsius by doubling the Celsius temperature and adding 30. This will give you an approximate Fahrenheit equivalent. For example, if it's 20°C, double it to get 40, then add 30 to get 70°F.


If it is 76 F what will it be in Celsius?

76 degree Fahrenheit is 24.44 Celsius. You do the Math: To convert Fahrenheit temperatures into Celsius: Begin by subtracting 32 from the Fahrenheit number. Divide the answer by 9. Then multiply that answer by 5.


What is the conversion formula to convert temperatures from Celsius into Fahrenheit degrees?

To convert Celsius to Fahrenheit, you can use the formula: (Celsius x 9/5) + 32. This formula will give you the equivalent temperature in Fahrenheit degrees.


Conversions between celsius Fahrenheit and kelvin?

To convert from Celsius to Fahrenheit: F = (C * 9/5) + 32 To convert from Fahrenheit to Celsius: C = (F - 32) * 5/9 To convert from Celsius to Kelvin: K = C + 273.15 To convert from Kelvin to Celsius: C = K - 273.15


WHICH IS FALSE 5 degrees celsius is warmer than 5 degrees Fahrenheit 15 degrees CELSIUS IS COOLER THAN 60 DEGREES FAHRENHEIT 30 DEGREES CELSIUS IS WARMER THAN 90 DEGREES FAHRENHEIT 35 DEGREES CELSIUS?

I suggest you convert each of the Fahrenheit temperatures to Celsius (or the other way round, each of the Celsius temperatures to Fahrenheit), and then compare.


How do you convert between Fahrenheit and minus Celsius temperature?

To convert from celsius to fahrenheit use the following formula : F = (C * 9/5) + 32


How to Convert 62.5 degrees Fahrenheit to Celsius?

Formula for conversion between Fahrenheit and Celsius is: Fahrenheit=5/9*Celsius+32 Celsius =(Farenheit-32)*9/5


How can you convert temperature in degrees Fahrenheit to degrees Celsius?

How to convert Fahrenheit temperatures to CelsiusSubtract 32o to adjust for the offset in the Fahrenheit scale.Multiply the result by 5/9.Example: convert 98.6o Fahrenheit to Celsius.98.6 - 32 = 66.666.6 * 5/9 = 333/9 = 37o C.


Does 1 Celsius degree equal 2.2 Fahrenheit degrees?

No. On the Celsius scale, the degree intervals are 1.8 times as large, so that a Celsius "degree" and a Fahrenheit "degree" are not the same thing. (see related question)


Conversion of temperatures?

kelvin=celsius+273 Celsius=0.55(F-32) Fahrenheit=(1.8*celsius)+32