0% found this document useful (0 votes)
39 views1 page

The C Source Code 09.09.2009

This C source code program converts a temperature in Celsius to its equivalent in Kelvin and Fahrenheit. The user inputs a temperature in Celsius, which is then converted to Kelvin by adding 273.16 and to Fahrenheit using the formulas. The converted temperatures are printed out using different formatting styles.

Uploaded by

'Aiman Wahid'
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views1 page

The C Source Code 09.09.2009

This C source code program converts a temperature in Celsius to its equivalent in Kelvin and Fahrenheit. The user inputs a temperature in Celsius, which is then converted to Kelvin by adding 273.16 and to Fahrenheit using the formulas. The converted temperatures are printed out using different formatting styles.

Uploaded by

'Aiman Wahid'
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

THE C SOURCE CODE

/* PROGRAM : TEMPERATURE CONVERSION CELSIUS TO KELVIN


AND FAHRENHEIT */
/* AUTHOR : FARIS RAZAK, PUSAT ASASI SAINS UNIVERSITI MALAYA */
/* DATE / DAY / HOURS : 01/09/2008, MONDAY, 1348 HRS */

#include <stdio.h>

void main (void)


{
double CELSIUS, KELVIN, FAHRENHEIT;

printf ("Enter a value of temperature in Celsius : ");


scanf ("%lf", &CELSIUS);
printf("\n");

KELVIN = CELSIUS + 273.16;


FAHRENHEIT = ((9.0/5.0)*CELSIUS) + 32.0;

printf("Temperature Celsius = %.4lf", CELSIUS);


printf("\n");
printf("Temperature Kelvin = %.4lf", KELVIN);
printf("\n");
printf("Temperature Fahrenheit = %.4lf", FAHRENHEIT);
printf("\n\n");

printf("Temperature Celsius = %.7le", CELSIUS);


printf("\n");
printf("Temperature Kelvin = %.7le", KELVIN);
printf("\n");
printf("Temperature Fahrenheit = %.7le", FAHRENHEIT);
printf("\n");
printf("\n");

printf("Temperature Celsius = %.4lf\n


Temperature Kelvin = %.4lf\n
Temperature Fahrenheit = %.4lf\n\n",
CELSIUS, KELVIN, FAHRENHEIT);
printf("Temperature Celsius = %.3le\n
Temperature Kelvin = %.3le\n
Temperature Fahrenheit = %.3le\n\n",
CELSIUS, KELVIN, FAHRENHEIT);
}

You might also like