Explore BrainMass
Share

# A C program to convert Celsius to Fahrenheit

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Program (code.c) & (codev2.c) to convert Fahrenheit to Celsius. Simplistic, DOS based so that I may digest and learn.

Program 1: Ask the user to input a Fahrenheit temperature, as a decimal number. Make clear what the user should enter, for example, "enter a whole number" or "please use the format xxx.xx.". Get the temperature from the user as a float. Calc, convert the temperature to Centigrade. Finally, display the two temperatures. Remember to format floats. The client offered that the algorithm for conversion is, "Centigrade is 5/9ths Fahrenheit minus 32". Results are rounded down (the remainder is ignored).

Program 2: Implements a switch: Offer the user three choices, obtains the choice and display an action based on that choice. One of the actions will include an if..else. Also include a default for incorrect choices.

Layout the planned structure and steps to accomplish the individual programs. Ensure brief, accurate and complete detailed instructions in the form of pseudocode, not code. Construct two brief explanations for the pseudocode. Provide both programs, pseudocode, and code (code in editable text).

https://brainmass.com/computer-science/pseudocode/program-convert-celsius-fahrenheit-200880

#### Solution Preview

=== Fahrenheit to Celsius convertor ===

The program to convert from fahrenheit to celsius requires the following three steps:

1) Read the input from the user
2) Convert the value
3) Display the value.

This input, compute, output pattern is quite common in simple programs
so it is good to become familiar with it. The stage for reading the
input from the user involves prompting the user and then getting the
input. In some cases it is desirable to validate the input.

Converting the value requires applying the conversion formula to the
input value to get a new value. The problem statement defined ...

#### Solution Summary

This solution provides a detailed C program that converts Celsius to Fahrenheit. It also provides an example of how to use the switch statement in C. For each of the programs included in this solution there is a detailed explanation of how the program works, a pseudo-code description, and the actual C program source code.

\$2.19