Write a
Fahrenheit= (9×Celsius) 5+32
Your program should create two integer variables for the temperature in Celsius and Fahrenheit. Initialize the temperature to 100 degrees Celsius. In a loop, decrement the Celsius value and compute the corresponding temperature in Fahrenheit until the two values are the same.
Since you are working with integer values, the formula may not give an exact result for every possible Celsius temperature. This will not affect your solution to this particular problem.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
SURVEY OF OPERATING SYSTEMS
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Electric Circuits. (11th Edition)
Concepts Of Programming Languages
Degarmo's Materials And Processes In Manufacturing
- For Python The user enters a number and tell them if the number is > 60 or not but keep it going in a loop until the user enters the number 0 which then exits the code and tells the user how many of their numbers entered is > 60.arrow_forwardThe following program will display the days for a month of the year. The input to the program is the number of days and the day of the week on which the first day of the month falls. The following program uses for loops to draw a rectangle of desired size. // P43a.cpp - This program displays the days of a month // Day 0: Sunday, Day 1: Monday, Day 2: Tuesday // Day 3: Wednesday, Day 4: Thursday, Day 5: Friday // Day 6: Saturday #include #include using namespace std; int main() { } int n_days, start_day; cout > n_days; cout >start_day; cout << "Sun\tMon\tTue\tWed\tThr\tFri\tSat\n"; for(int i = 0; i < start_day; i++) { cout << "\t": } for(int j = 1; j <= n_days; j++) { if(j%7 == 0) cout << endl; cout <arrow_forwardWrite a program that keeps reading integers from the user until he enters zero. The programshould then displays the following: Sum of odd numbers Average of even numbers (use loops)arrow_forwardA Prime Number, is a number that can be divided evenly only by 1, or itself. Write a Java program, that prompts the user toenter a number, and determines if it is a prime or not. Use while-do looparrow_forward(Program) Write a program to simulate the rolling of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with theexpressiondots=(int)(6.0randomnumber+1), where random number is between 0 and 1.)arrow_forwardThe distance a vehicle travels can be calculated as follows:Distance=Speed×Time. Design a program, in Java, that asks a user for the speed of a vehicle in miles per hour and how many hours it has travelled (Assume the two values are integers). Your program should then use a loop to display the distance the vehicle has traveled for each hour of that time period. (For example, entering 50 mph and 4 hours should produce output like: Hour 1: 50 miles, Hour 2: 100 miles, Hour 3: 150 miles, Hour 4: 200 miles. )arrow_forwardPrint the decimal, octal, and hexadecimal values of all characters between the start and stop characters entered by a user. For example, if the user enters an a and a z, the program should print all the characters between a and z and their respective numerical values. Make sure that the second character entered by the user occurs later in the alphabet than the first character. If it does not, write a loop that repeatedly asks the user for a valid second character until one is entered.arrow_forwardSuppose that your electric company charges you once per year for the electricity you use. Suppose the electric company charges you $0.06 per kilowatt-hour for the first 1000 kilowatt hours you use and $0.08 per kilowatt-hour for all kilowatt-hours more than 1000 that you use. Write an algorithm that loops to ask the user to enter the number of kilowatt-hours used for each of the last 12 months, computes and prints the amount to be charged that month, and afterwards prints the total amount to be charged for 12 months worth of electric usage.arrow_forwardWhen it finishes the calculation, the program should ask whether the user wants to do another calculation. The response can be ‘y’ or ‘n (use while loop). Some sample interaction with the program might look like this: Enter first number, operator, second number: 10 / 3 Answer = 3.333333 Do another (y/n)? y Enter first number, operator, second number: 12 + 100 Answer = 112 Do another (y/n)? narrow_forwardWrite a Python program that will prompt the user for an input number between 11 and 100 inclusive. Continually subtract 1 from this input number until the number reaches matching digits. The program should not move forward until the user enters a positive integer value. Be sure to add a beginning and ending statement to let the user know the program is starting and ending. Use loops to validate the user input and to countdown until matching digits are found. Add comments throughout the code. An Example: Sum of Values Enter a positive integer value between 11 and 100: 59 Output: 59 58 57 56 55 End of results. Another Example: Sum of Values Enter a positive integer value between 11 and 100: -44 Error: Please enter a positive integer value (11 - 100): 0 Error: Please enter a positive integer value (11 - 100): 101 Error: Please enter a positive integer value (11 - 100): 8 Error: Please enter a positive integer value (11 - 100): 11 Output: 11 End of results.…arrow_forwardpython 3arrow_forwardCombine the statements that you wrote in Exercise 3.4 into a program that calculates thesum of the integers from 1 to 10. Use the while statement to loop through the calculation and increment statements. The loop should terminate when the value of x becomes 11.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning