The value of the variable A at the end of the loop is 1. int A =7; while (A>= 3) A -= 2;
Q: Volume and Area of a Regular Icosahedron An icosahedron is a regular polyhedron with 20 congruent…
A: Step: 1 Step 1Tips to keep in mind: 1) Just one geometric solid is really the hexagonal pattern,…
Q: The value of the variable A at the end of the loop is 1. int A =7; while (A>= 3) A -= 2; Select one:…
A: Give program is, int A=7; while (A>=3) A -= 2; Here the variable A is initialised to 7 and the…
Q: hallenge Problem (pyhton) T E S T S C O R E S Write a program that…
A: Program Approach: 1- As mentioned in the assignment created the main function. 2- def keyword used…
Q: Complete the following for loop. The loop should display the numbers from 0 to 9 and from 0 to -9.…
A: #include<iostream> using namespace std; int main() { for(int i=0,j=0;i<10,j>-10;i++,j--)…
Q: You have the following while-loop: x = 4; while (x <= 9) disp('Am I done yet?') x = x + 2.5; end How…
A: The while-loop will continue as long as the condition x <= 9 is true. Starting with x = 4, the…
Q: Write a program that plays a guessing game with the user. The program should have the right answer…
A: Please find the answer below :
Q: Writing a while loop Write a while loop that continues to increment userValue by 5 as long as…
A: Input: userValue (an integer)Output: userValue (an integer)1. Start with the initial value of…
Q: random number guessing game with while loops create a program (or adapt the guessing game program…
A: Define header file <iostream> which is used for basic i/o operations in the file Define main…
Q: Convert the following for loop statement to a while loop and to a dowhile loop:long sum = 0; for…
A: long sum = 0; for (int i = 0; i <= 1000; i++) sum = sum + i; In while loop: long sum=0; int…
Q: The statement For J = 3 To 12 Step 2 causes the loop to iterate _____ times
A: Taking the simple programming code which print the list of numbers from 3 to 12 and also print the…
Q: No written by hand solution IN JAVA - NEEDS DRIVER AND CLASS PROGRAM Average Rainfall Write a…
A: Step-1) First, initializing the variables as int numberOfYears = 0, totalRainfall = 0;…
Q: QUESTION 1 What is i after the following for loop? int y = 0; %3D for (int i = 0; i < 10; ++i) { %3D…
A: int y=0; for(int i=0; i<10;i++){ y+=i; //y=0+1+2+3+4..... 9 } // this loop…
Q: Seasons Write a program that takes a date as input and outputs the date's season. The input is a…
A: Start Takes the value of month as input. Takes the value of date from the user. If month is march…
Q: Complete the following do-while loop. The loop should display the message "Hello." twelve times.…
A: Complete code: #include <iostream>using namespace std;int main(){ //declaration int…
Q: You should use the while loop when you want to make sure the loop executes at least once. True or…
A: Actually, loops are used to repeat the statements.
Q: All of the following are looping control structures except Select one: while loop do-while loop…
A: Control structures change the typical consecutive progression of an assertion execution. Loops…
Q: Budget Analysis (Running Total) Write a program BudgetAnalysis.py) that asks the user to enter the…
A: Introduction An else if statement in Python is an if-else statement that allows for multiple…
Q: How many times will the following do-while loop be executed? int x = 50; do {…
A: The answer is 2. 2 times the do-while loop executed.
Q: Python programming Write a program that generates a random number and asks the user to guess what…
A: Here in this code, change the range of random numbers as per your convenience. Code: #from random…
Q: Random Number Guessing Game Write a program that generates a random number and asks the user to…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT-----------
Q: The while loop checks the loop-continuation-condition ______.
A: while is a conditional statement that is supported by many programming languages
Q: the output = int a = 10; LOOP: do { if( a == 15) { a = a + 1; goto LOOP; } cout << "value of a: " <<…
A: Please find the answer below :
Q: True or False? In a do…while loop, the condition is checked at the bottom of the loop.
A: Verify the statement given with a proper explanation: In a do…while loop, the condition is checked…
Q: Create a python program that allows a professor to input test results, and calculate the average and…
A: Introduction :- Here's a python program that allows a professor to input test results, validate…
Q: Happy Numbers Programming challenge description: A happy number is defined by the following process.…
A: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;…
Q: Convert the following for loop to a while loop: for (int x = 50; x > 0; x--){ cout << x…
A: Code #include<iostream>using namespace std;int main(){int x = 50; while(x > 0) {cout…
Q: JAVA If the for loop counter variable is declared and initialized in the for loop header the…
A: SOLUTION: The answer of the above statement is: True The counter variable of for loop can be…
Q: Overview This program will prompt a user for a start and a limit, it will then while-loop through,…
A: Prompt the user to input the start value of the loop and store it in the variable start. Prompt the…
Q: Write code that lets the user enter a number. The number should be multiplied by 2 and printed until…
A:
Q: In Python - Write a program that asks the user to enter two numbers, a low number and a high number.…
A: Introduction: Here we have to write a python program that asks the user to enter two numbers, a low…
Q: Write a while loop which prompts the user for the name of a drink and the cost. Add these new items…
A: Python used to answer this question
Q: How many times will the following do-while loop be executed? int x = 0; do {…
A: Introduction: Loops are used in programming to execute a block of code repeatedly until a certain…
Q: Unlabeled Break: Create a Java program that uses a "while" loop to output the numbers from 1 to 10…
A: We have to create Two java programs first uses Unlabeled Break: uses a "while" loop to output the…
Q: Username: mary Type your current password: secret Username or password incorrect Try again.…
A: error 404
Q: Write a program that generates a random number between 1 and 500 and asks the user to guess what the…
A: C++ Program: #include <iostream>#include<cstdlib> using namespace std; //Main…
Q: CENGAGE MINDTAP 4-Accumulating Totals in a Loop in Java Accumulating Totals in a Loop 69 Ⓡ Summary…
A:
Q: Question#2. The distance a vehicle travels can be calculated as fallout: Distance = Speed * Time For…
A: PROGRAM: //import packagesimport java.io.FileWriter;import java.io.IOException;import…
Q: True or False: You should be incrementing the control variable of a for loop True or False: you can…
A: 1) Given statement - You should be incrementing the control variable of a for loop Answer = False…
Q: Prompt Problem: A company wants a program that will calculate the weekly paycheck for an employee…
A: Flowchart:
Q: Create a class name AddAgain for do-while loop that asks the user to enter two The numbers should be…
A: Create a class name AddAgain for do-while loop that asks the user to enter two The numbers should be…
Q: Using C# in Microsoft Visual Studio* create an application that lets the user enter a nonnegative…
A: The C# code is given below with an output screenshot
Q: In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program…
A: Actually, given information is: The source code file already contains the necessary variable…
Step by step
Solved in 2 steps with 2 images
- Even though the EXIT clause can be used in any type of loop, it is considered good form to use the EXIT clause only in basic loops. Answers: Yes NoUsing a Sentinel Value to Control a while Loop in Java Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the…MUST BE IN PYTHON PROGRAMMING CODE!!!!! NO C++ or Java!! Directions: Design a program with a loop that lets the user enter a series of names (in no particular order). After the final person’s name has been entered, the program should display the name that is first alphabetically and the name that is last alphabetically. For example, if the user enters the names Kristin, Joel, Adam, Beth, Zeb, and Chris, the program would display Adam and Zeb. Additional requirements: Note that the possible set of input values can include negative, 0, or positive values, but not the sentinel value of -99. DESIGN HINT: • When determining the largest (or smallest) value in a set of numbers, remember to use variables to keep track of the current largest (or smallest) number found thus far. These variables can then be used as a comparison to each subsequent input number to see if the new number is larger (or smaller) than the current largest (or smallest) number and updated appropriately. At the end of all…
- Problem Description: A while loop and do/while loop will repeat code while the condition is true. The basic difference is when the condition is checked. The while loop checks the condition before the loop starts or after the loop ends. A do/while loop will check the condition at the end of the loop to determine if the loop should be repeated. A do/while loop will run at least once whereas a while may be skipped entirely. while ( ) do I/ Repeated code goes here I/ Repeated code goes here while ( ); Checkpoint 1: Use a while loop to display the numbers 1 through 10. You must initialize your loop counter before the loop and increment the loop counter inside the loop. Checkpoint 2: Use a while to ask the user for a list of numbers. It is not known how many numbers the user will enter, but the last number will be -1. After all numbers have been entered, state how many numbers were put in. Checkpoint 3: Use a do/while loop to display the numbers I through 10. You must initialize your loop…Chapter 4 Loops and Files 17. Random Number Guessing Game Write a program that generates a random number and asks the user to guess what the num- ber 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 cor rectly guesses the random number.This program requires the student to create a programming loop. The program's loop with loop between 5 and 50 times. Each loop will represent one week of the user eating and buying food. Each week the user will input the amount he or she spent on food. If the person spends more than $250 then the program will output "You are going to get fat." If the person spends less than $50.55 then the program will output "You are going to starve." After the final loop the program will display the lowest amount spent on any one week along with the most spent on any one week.
- Looping Construct with Floating Point Numbers Write a program that utilizes a while-loop to read a set of five floating-point values from user input. Include code to prevent an endless loop. Ask the user to enter the values, then print the following data: Total Average Maximum Minimum Interest on total at 20% Answer:In Java, If a semicolon is placed at the end of a for statement, the action of the for loop is empty. True or FalseThe following loop displays _____. for (int i = 1; i <= 10; i+=2) { System.out.print(i + " "); i++; } a)1 2 3 4 5 6 7 8 9 b)1 2 3 4 5 6 7 8 9 10 c)1 3 5 7 9 d)3 5 7 9 11
- The program segment has errors. Find as many as you can. // This code should use a loop to raise a number to a power. int num, bigNum, power, count;cout << "Enter an integer: "; cin >> num; cout << "What power do you want it raised to? "; cin >> power; bigNum = num; while (count++ < power); bigNum *= num; cout << "The result is << bigNum << end1;Distance Traveled, v 1.0 Purpose. The purpose of this lab is to perform a calculation repetitively within a loop. The loop may be either a while loop or a for loop. You are to write a program that calculates the distance a vehicle has traveled in a certain number of hours. Write a program called vehicle Trip.cpp to calculate the distance traveled for a given speed. Requirements. 1. Using the following formula: distance rate * time = calculate how many miles a vehicle has travelled in a certain number of hours. 2. Have the program ask the use for the speed of the vehicle (in miles per hour) and how many hours the vehicle has traveled. Do not accept a negative number for the speed of the vehicle, and do not accept a value less than 1 for hours the vehicle has traveled. 3. The program should use a loop to display the distance the vehicle has travelled for each hour of the time period that has been inputted. Program I/O. Input: Speed of the vehicle (in miles per hour), and Number of hours…Turtle Drawing with Loops Objective: To make a drawing using turtle graphics and nested loops Requirements: -Your program should ask the user at least two questions, and use the answers to help make the drawing. -Your program must have at least one pair of nested loops (a loop inside of a loop) to do some of the drawing -Your drawing cannot be made up only of rotated polygons coming from the center of the screen like we did in class. -Please write a new program for this assignment - don't use code from any in-class exercises. -For example, your program could draw a field of flowers, or you could draw a repetitive square pattern like you might see on a rug.