answersLogoWhite

0


Best Answer

#include<io.sys>

// Temperature conversion functions:

float celcius_to_fahrenheit (double c) { return c * 9.0 / 5.0 + 32.0; }

float celcius_to_kelvin (double c) { return c + 273.150; }

float fahrenheit_to_celsius (double f) { return (f - 32.0) * 5.0 / 9.0; }

float fahrenheit_to_kelvin (double f) { return celsius_to_kelvin (fahrenheit_to_celsius (f));

float kelvin_to_celsius (double k) { return k - 273.150; }

float kelvin_to_fahrenheit (double k) { return celsius_to_fahrenheit ( kelvin_to_celsius (k));

int main (void) {

double c, f;

scanf ("Enter a temperature in Celsius: %f", c);

printf ("%f Celsius is equal to %f Fahrenheit\n", c, celcius_to_fahrenheit (c));

return 0;

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the source code in C to convert Celsius to Fahrenheit?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is it possible to convert the hex code into a source code?

yes.


How do you convert c exe to source code?

Not possible.


What is role of compiler?

It coverts your source code into machine code so the computer can execute it.


what tool used to convert C++ source code into executable machine code?

Compliers are used to convert C++ into assembly code. Then a tool called an &quot;assembler&quot; converts that code into machine code. Finally, a &quot;linker&quot; connects all of those machine code files into a single executable.


How do you write a program in C to convert temperatures between Fahrenheit and Celsius?

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;}

Related questions

Is it possible to convert the hex code into a source code?

yes.


How do you convert .c extension to .exe?

To convert source code (.c file) to an executable (.exe) file you have to use a compiler, which is a translator of source code to machine code.


What is the pseudocode for converting Fahrenheit to Celsius?

how to write the pseudo code for : (5/9)(f-32)


How do you convert c exe to source code?

Not possible.


How do you convert the source code into executable code by double clicking on it?

There's no such thing as 'Executable Code'! The source code is compiled and the final result is an executable.


What is role of compiler?

It coverts your source code into machine code so the computer can execute it.


Tell me the pseudo code for converting Fahrenheit to Celsius?

Subtract 32 from the temperature in Fahrenheit. Multiply the result with 5/9.C = (F-32) * 5 / 9


What is a source code in Visual BASIC?

In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.In Visual BASIC and other languages, source code refers to the code that you actually type when you are writing a program. Computers convert this code to machine code in order to be able to run the program.


The code of Fahrenheit to celsius code in visual basic?

'make fTemp and cTemp variables and initialize fTemp to a text box cTemp = (fTemp - 32) * 5 / 9


Why is there a need for compiler?

Compilers are needed to convert human readable source code into machine executable code.


How is Compiler Different from Interpretor?

A traditional compiler converts the source code to machine code; many recent compilers convert the source code to some intermediate language instead. An interpreter runs the source code directly, which means the source code is basically "interpreted" one line at a time.


How do you change source code into machine code?

A program called a compiler, or sometimes an assembler (depending on the programming language) does this for you. You write the source code, then invoke the program that will convert this into machine language.