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:

  1. Define variables: startingPoint (float), stepSize (float), goalPoint (float), num (float), celsius (float)
  2. Ask the user to input the value of the "Starting Temperature", and store it in startingPoint.
  3. Ask the user to input the value of the "Goal Temperature", and store it in goalPoint.
  4. Ask the user to input the value of the "Temperature Increments", and store it in stepSize.
  5. Print "Fahrenheit\tCelsius " (\t is a tabulation in the string, creating a space between the two words)
  6. Set num to startingPoint
  7. If stepSize is positive AND goalPoint is more than startingPoint
    1. while num < goalPoint
      1. celsius = (num - 32) * 5 / 9
      2. Display num, followed by "\t\t", followed by celsius
      3. Add stepSize to num
    2. If num >= goalPoint
      1. num = goalPoint
      2. celsius = (goalPoint - 32) * 5 / 9
      3. Display num, followed by "\t\t", followed by celsius
  8. Else if stepSize is negative AND goalPoint is less than startingPoint
    1. while num > goalPoint
      1. celsius = (num - 32) * 5 / 9
      2. Display num, followed by "\t\t", followed by celsius
      3. Add stepSize to num
    2. If num <= goalPoint
      1. num = goalPoint
      2. celsius = (goalPoint - 32) * 5 / 9
      3. Display num, followed by "\t\t", followed by celsius
  9. Else if goalPoint is the same as startingPoint
    1. celsius = (num - 32) * 5 / 9
    2. Display num, followed by "\t\t", followed by celsius
  10. Else
    1. Report an error, indicating that the loop would continue infinitely with those values.
  11. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!