Hide Transcribed Text Write c++ a program that will accept a Celsius value between -40 degrees and 100 degrees. The number entered may contain decimal digits. Make these high and low values named constants. Also, make all temperatures floating point numbers and with two decimal digits when displayed. Using a while loop, allow the user to enter the value and if not in range continue to prompt the user for a valid value. Next prompt the user for the number of temperatures to be displayed. In a while loop repeat the following steps: 1. Calculate the Fahrenheit equivalent temperature and Kelvin equivalent temperature. The formulas are: Fahrenheit=9/5×Centigrade +32 Kelvin=Centigrade +273.15
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Hide Transcribed Text
1) Below is C++ program that will accept a Celsius value between -40 degrees and 100 degrees, convert in Fahrenheit and Kelvin equivalent and display
- This program will first prompt the user to enter a Celsius value within the specified range. If the entered value is not in the range, it will continue to prompt for a valid value.
- Next, it will prompt the user for the number of temperatures to be displayed.
- Then, in a while loop, it will calculate and display the Fahrenheit and Kelvin equivalents of the Celsius temperature for the specified number of times.
2) Save program in cpp file, build and run
Step by step
Solved in 3 steps with 1 images