Write a
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.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Absolute C++
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
SURVEY OF OPERATING SYSTEMS
Starting Out With Visual Basic (8th Edition)
Modern Database Management
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
- n is an integer variable.Write a while loop that prints integer numbers starting with n and dividing the number to 4 each time, while the new number is greater than 0.(Example: If n is 2077, it will print 2077 519 129 ...)Write only the statements to perform the above explained task, nothing else.Use while loop, don't use for loop.arrow_forwardWrite a program that asks the user for a number of integer test scores. It then has the user enter that number of scores and computes the average. Ex: If the input is: 5 95 90 82 88 87 the output is: Your test average is: 88.4 You can assume that the first number is greater than 0. Hint: Use a loop to calculate the sum. When you are done with the loop, calculate the average. pythonarrow_forwardWrite a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number. Program should count and display number of tries to win the game. (Use for loop to solve the problem) Python programarrow_forward
- Write a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the annual interest rate, the starting balance, and the number of months that have passed since the account was established. A loop should then iterate once for every month, performing the following: A) Ask the user for the amount deposited into the account during the month. (Do not accept negative numbers.) This amount should be added to the balance. B) Ask the user for the amount withdrawn from the account during the month. (Do not accept negative numbers.) This amount should be subtracted from the balance. C) Calculate the monthly interest. The monthly interest rate is the annual interest rate divided by twelve. Multiply the monthly interest rate by the balance, and add the result to the balance. After the last iteration, the program should display the ending balance, the total amount of deposits, the total amount of withdrawals, and the total interest earned.arrow_forwardWrite a program Digits that prompts the user to input a positive integer and then outputs the number reversed and the sum of the digits. For example, if the user enters the number 3456, then your program should output 6543 and the sum as 18. Use a while loop. EXAMPLE OUTPUT: Enter an integer: 3478246 Number reversed: 6428743 Sum of digits: 34 You may assume the user enters a number smaller than the max int (2,147,483,647).arrow_forwardWrite a program that will print the message “I love computer science” 12 times. Use a while loop. Instead of printing 12 times, ask the user how many times the message should be printed. You will need to declare a variable to store the user’s response and use that variable to control the loop. Number each line in the output, and add a message at the end of the loop that says how many times the message was printed. So if the user enters 3, your program should print this: _____________________________________ 1 I love computer science 2 I love computer science 3 I love computer science This message is printed 3 times.arrow_forward
- Pythonarrow_forwardWrite a program that plays a simple dice game between the computer and the user. When the program runs, a loop should repeat 5 times. Each iteration of the loop should do the following: Generate a random integer in the range of 1 through 6. This is the value of the computer’s die. Ask from user an integer in the range of 1 through 6. This is the value of the user’s die. The die with the highest value wins. (In case of a tie, there is no winner for that particular roll of the dice.) You need to validate the input if it’s correct or not. As the loop iterates, the program should keep count of the number of times the computer wins, and the number of times that the user wins. After the loop performs all of its iterations, the program should display who was the grand winner, the computer or the user.arrow_forwardWrite a program that prompts the user to firstly input the amount a person has budgeted for a month. A loop should then prompt the user to input each of the expenses (zero indicates the user is done with entering an expense) for the month and keep a running total (the total amount of expenses). When the loop finishes, your program should calculate the difference between budgeted. amount and the total expenses. If the budgeted amount is larger than total expenses, display "you are $xx under budget". If the total expenses is larger than budgeted amount, display "you are $xx over budget". If the total expenses is equal to budgeted amount, display "good planning". Your result should be like, for example, below: Enter amount budgeted for the month: 1000 Enter an amount spent(0 to quit): 200 Enter an amount spent(0 to quit): 50 Enter an amount spent(0 to quit): 150 Enter an amount spent(0 to quit): 0 You are $600 under budget.arrow_forward
- In python, A customer in a store is purchasing items. Write a program, using a while loop, that asks for the price of each item, then displays the subtotal of the sale, the amount of sales tax, and the total when the customer is done entering all the items. Assume the sales tax is 7 percent. The customer should be allowed to enter as many items as they wish. The while loop should terminate when the user hit the key (Return) on the keyboard. (Hint: Use a null or empty string). Optionally, if you would like to round the dollar amount to two decimal places, you can use output formatting construct in your print statement. For example: print("Sales tax: ", format(sales_tax, '.2f')) will round to two decimal places. Expected Output: Enter the item price or <ENTER> to end: 22.50Enter the item price or <ENTER> to end: 1.99Enter the item price or <ENTER> to end: 45.30Enter the item price or <ENTER> to end: 70Enter the item price or <ENTER> to end: 5Enter the item…arrow_forwardWrite a program that helps a company manage salaries of its employees. Your program should ask for the number of hours worked and the hourly rate of an employee than, display the salary. This program still asks the user to enter the information of many employees until enters a zero value. Sample Run: Enter the number of hours worked (negative nbr to end): 32 Enter hourly rate of the worker: 100 Your salary is $3200 Enter the number of hours worked (negative nbr to end): 40 Enter hourly rate of the worker: 5 Your salary is $200 Enter the number of hours worked (negative nbr to end): 42 Enter hourly rate of the worker: 10 Your salary is 5420 Enter the number of hours worked (negative nbr to end): 0arrow_forwardAt one college, the tuition for a full-time student is $8000 per semester. It has been announced that the tuition will increase 3 percent each year or the next 5 years. Write a Visul Basic program with a loop that displays the projected tuition amount for the next 5 years. Use a constant for the percentage of change and for the starting tuition. Print the tuition amounts with a dollar sign and two decimal places.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr