Question: in C language Write a program that converts a sequence of Farenheit temperatures to Celsius: Define variables: startingPoint (float), stepSize (float), goal Point (float), num
in C language
Write a program that converts a sequence of Farenheit temperatures to Celsius:
- Define variables: startingPoint (float), stepSize (float), goalPoint (float), num (float), celsius (float)
- Ask the user to input the value of the "Starting Temperature", and store it in startingPoint.
- Ask the user to input the value of the "Goal Temperature", and store it in goalPoint.
- Ask the user to input the value of the "Temperature Increments", and store it in stepSize.
- Print "Fahrenheit\tCelsius " (\t is a tabulation in the string, creating a space between the two words)
- Set num to startingPoint
- If stepSize is positive AND goalPoint is more than startingPoint
- while num < goalPoint
- celsius = (num - 32) * 5 / 9
- Display num, followed by "\t\t", followed by celsius
- Add stepSize to num
- If num >= goalPoint
- num = goalPoint
- celsius = (goalPoint - 32) * 5 / 9
- Display num, followed by "\t\t", followed by celsius
- while num < goalPoint
- Else if stepSize is negative AND goalPoint is less than startingPoint
- while num > goalPoint
- celsius = (num - 32) * 5 / 9
- Display num, followed by "\t\t", followed by celsius
- Add stepSize to num
- If num <= goalPoint
- num = goalPoint
- celsius = (goalPoint - 32) * 5 / 9
- Display num, followed by "\t\t", followed by celsius
- while num > goalPoint
- Else if goalPoint is the same as startingPoint
- celsius = (num - 32) * 5 / 9
- Display num, followed by "\t\t", followed by celsius
- Else
- Report an error, indicating that the loop would continue infinitely with those values.
- Close the program
Bonus Points: You will get 2 bonus points in this lab for doing each of the following modifications:
- Adjust the code so all the while loops are for loops instead.
- Make the program ask the user if they want to do another operation, repeating if they enter y or Y, closing if they enter n or N. It asks again on anything else.
- For this to be accepted, you must use a loop for it!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
