After the following statements are executed, val should contain a capital letter. Write a while loop to follow the given code that will repeatedly reprompt and reread input if this is not the case. (note that a capital letter is anything >='A' and <= 'Z') char val; cout<<"Enter a capital letter\n"; cin>>val;
Q: Complete the loop condition so the code below prints from 1 to 9. int j for(...... { System out…
A: Solution:
Q: 19.1 LAB: Count multiples Write a program that takes three integers as input: low, high, and x.…
A: Write a python code that outputs the number of multiples of x between low and high inclusive. Ex: If…
Q: O All True or false O O O O The conditional for the loop must only produce either a true or false…
A: According to the Question below the Solution: as per our company guidelines we are supposed to…
Q: 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number…
A: Note-since programming language is not specified we providing solution in python programming Answer…
Q: 2. Write a while loop program that accepts numbers, then identify which of the numbers entered is…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: Floor Division of two integer numbers will give answer as integer number. Select one: O True O False…
A: Given: A) Floor Division of two integer numbers will give answer as integer number. Select one: True…
Q: (1) Prompt the user to enter a string of their choosing. Output the string. (1 pt) Ex: Enter a…
A: def get_num_of_characters(input_str): count = 0 for i in input_str: count = count + 1…
Q: Question 42 Refer to the following program snippet. What type of loops is shown below? AND RO, RO,…
A: In the above code BEGIN ST R0,IND // Initialization NOT R1,R2 //Condition INCR LD…
Q: c++ problem. Please paste indented code and keep the output same Write a loop to print all odd…
A: ALGORITHM:- 1. Take input value for x from the user. 2. Use loop to print the odd values from 1 to…
Q: Which of the following Statement is NOT True? a)do-while loop will not execute at least once, if…
A: In choice a, it is wrong because it is an exit control loop that executes at least once when the…
Q: Develop a program to ask the user to enter a number, if the user enters a positive integer, then…
A: Sample Response: //C program to ask the user to enter a number,if the user enters a positive…
Q: What will be the value of total after the following statements have been executed? total = 0 for x…
A: Let's execute the above program by a dry run.
Q: The do … while loop in the following program is supposed to read some numbers until it reaches a…
A: Code: #include <iostream>using namespace std;int main(){ //declaring variablesint total =…
Q: Use a while loop (or do-while) to process the following for at least five employees: Ask the user…
A: Given:
Q: Modify the while loop so that when a user enters a price, the system validates whether the value…
A: With the while loop we can execute a set of statements as long as a condition is true.
Q: When does the following while loop terminate? char ch = 'D'; while ('A' (static_cast (ch) + 1);
A: Given while loop: char ch = 'D';while ('A' <= ch && ch <= 'Z') ch =…
Q: QUESTION 10 Consider the steps you would take to write code that prints the output (below) meeting…
A: Loops can execute any statements multiple times depending upon the specified condition. While loop…
Q: int x 1, y-3; dol x += 2; y +- 2; cout << x << " " «y< endl; } while (y < 11); Write an equivalent…
A: EQUIVALENT CODE: #include <iostream>using namespace std;int main(){ int x, y; for(x=1,…
Q: Is a repetition control structure that allows you to efficiently write a loop that needs to execute…
A: The correct option is first option which is for-loop.
Q: 12. What loop statement allows you to specify exactly how many times you want to loop? a) while b)…
A: Step 1 The answer is given in the below step
Q: counterLetterlords = 0; for (; ; ++counterLetterwords) if (counterLetterWords < 4) cout «…
A: #include <iostream>using namespace std;int main() { int counterLetterWords=0; for(; ;…
Q: The while loop program below is to display two variables in their given range: #include using…
A: Given: To correct the given code.
Q: Write a statement(s) that, using a loop, that displays 5 random numbers in the range of 1 through…
A: here in this question we have asked to write a program which print 5 random integer in range [1,100]…
Q: 1. Write a program using while loop statement to evaluate the equation y = xn when n is a…
A: Code: #include <stdio.h>#include<conio.h>int main(){int count, n;float x,y;printf("Enter…
Q: COUNTDOWN TO ZERO: 4 COUNTDOWN TO ZERO: 3 COUNTDOWN TO ZERO: 2 COUNTDOWN TO ZERO: 1 COUNTDOWN TO…
A: Algorithm:- Step1:- Start Step 2:- declare int n=4; step 3:- start a while loop and pass the…
Q: 11. An if statement/while loop will run so long as the condition of the expression is True or False?
A: 1) if statement is the most simple decision-making statement. It is used to decide whether a certain…
Q: A continue statement causes execution to skip to: A the first statement after the loop B the next…
A: “continue” statement: It is used inside the loops. When a continue statement is encountered inside…
Q: When does the following while loop terminate? char ch = 'D';while ('A' <= ch && ch <=…
A: The given while loop will be terminated after 23 iterations.
Q: * the Iteration Statements case stetement for statement if statement * ?the while-loop form is while…
A: (A)Iteration statement - For
Q: Write a program segment with a do-while loop that displays whether a user- entered integer is even…
A: Program: #include <iostream>#include <stdlib.h>using namespace std;int main(){int num =…
Q: Write a program that produce factorial of a number entered by user using do-while Loop.
A: Lets see the solution.
Q: PYTHON PROGRAMMING ONLY. Please provide explanation as well. Thank you. Write a while loop that lets…
A: Here is the python code; See below step for code.
Q: 51- Each statement end with(;), but---- isn't. * O switch-case For loop O #include O all the above
A: Switch case syntax is: switch(condition) { case 1: case 2: } for loop syntax is:…
Q: Which of the following statements is false? Select one: O It is possible that the body of a while…
A: Option1 ) is Correct as, if in first iteration only Condition of while becomes incorrect then body…
Q: Construct a do-while() loop in c, which continues to display the following menu: 1. Add funds to…
A: Following is the C program that displays the menu and prompt user to enter the choice. If the choice…
Q: Write pseudo code or flow chart to find the value of 2n by using a for loop, where n is an integer…
A: according tp our guidelines we can answer only one question if you want another answer of your…
Q: QUESTION 3-do while loop ЗА Suppose we declare the following variables: int count = 0; int input =…
A: COMPLETE PROGRAM WITH THEIR OUTPUT OF EACH PROBLEMS .
Q: How many times will the for-loop be executed? #include 2 using namespace std; 3 int main() { for…
A: The solution for the above given question is given below:
Q: Assume j, i, n, and max have been declared. Use the following code to answer the questions that…
A: Please find the answer below :
Q: 3. After the following statements are executed, score should contain a value from zero through 100.…
A: Approach We will use while loop along with logical OR (||) operator to check the value of score that…
Q: Write a program that takes three integers as input: low, high, and x. The program then outputs the…
A: low=int(input("enter the lowest number : ")); # here we take the lowest…
Q: need help with pyhton......paste ur indented code here Implement the following: 1) Use a loop to…
A: Given: Implement the following: 1) Use a loop to request user input from the console. 2) The loop…
Q: Assume that the following code is correctly inserted into a program:int num = 1;int count;for (count…
A: (a) The final value of num is “42”. Hence the correct answer is option (ii). Explanation:…
Q: Write a Python program that uses a for loop with the range function to display the integers from 5…
A: A required Python program is as follows, print("Integer\t Square Cube") for intV in…
Q: program4_1.py Write a program that uses a for loop and the range function to examine all integers…
A: The pseudocode is Start initialize n=0,c=0,and l as a list start for loop from i= 999 check if…
Q: Now modify the program to display the averages of homework, quizzes and tests for each student using…
A: I have given an answer in step 2.
Q: Q1: Write a program using loop statement that displays the following patterns. * * 黃 蕾
A: According to the Question below the Complete Program: Program Output:
Q: 1. Write a program using while loop statement to evaluate the equation y xn when n is a non-negative…
A: while loop with incrementing attribute i are used to solve this problem.
Q: What's wrong? for (int k =2, k<=12, k++) the increment should always be ++k B the commas should be…
A:
Q: Complete code that prints the following output using a while loop. Declare a loop-control variable…
A: Here I have initialized the variable noOfSteps with 1. Next, I have used a while loop with condition…
After the following statements are executed, val should contain a capital letter. Write a while loop to follow the given code that will repeatedly reprompt and reread input if this is not the case. (note that a capital letter is anything >='A' and <= 'Z')
char val;
cout<<"Enter a capital letter\n";
cin>>val;
Step by step
Solved in 3 steps with 1 images
- question 1 : Divisors develop a code using modulo operator (%) to print out all the divisors of a user entered number. Your program should prompt the user to enter a positive number or 0 to end. Using a loop variable that starts at 1, your program should print out all the divisors of the entered number plus the number of printed divisors and their sum.For example:This program identifies and displays divisors of a given number.Developed as an IPC144 project.Enter a positive number. Enter 0 to end: 151 3 5 154 divisorssum of divisors: 24 Enter a positive number. Enter 0 to end: 361 2 3 4 6 9 12 18 369 divisorssum of divisors: 91 Enter a positive number. Enter 0 to end: 431 432 divisorssum of divisors: 44Enter a positive number. Enter 0 to end: 0Thanks and bye! question 2: Divisor counter develop a c code qsing what you did in question1,to develop a function calledunsigned divisorCount (unsingned num) That gets an integer number as an input parameter and returns the number of divisors of…Basic while loop expression. Write a while loop that prints userNum divided by 4 (integer division) until reaching 2 or less. Follow each number by a space. Example output for userNum = 160:40 10 2 Note: These activities may test code with different test values. This activity will perform four tests, with userNum = 160, then with userNum = 8, then with userNum = 0, then with userNum = -1. See "How to Use zyBooks".Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message..Divisors flow chart using modulo operator (%) to print out all the divisors of a user entered number. Your program should prompt the user to enter a positive number or 0 to end. Using a loop variable that starts at 1, your program should print out all the divisors of the entered number plus the number of printed divisors and their sum.For example:This program identifies and displays divisors of a given number.Developed as an IPC144 project.Enter a positive number. Enter 0 to end: 151 3 5 154 divisorssum of divisors: 24 Enter a positive number. Enter 0 to end: 361 2 3 4 6 9 12 18 369 divisorssum of divisors: 91 Enter a positive number. Enter 0 to end: 431 432 divisorssum of divisors: 44Enter a positive number. Enter 0 to end: 0Thanks and bye! Divisor counter Using what you did in part 1,to develop a function calledunsigned divisorCount (unsingned num) That gets an integer number as an input parameter and returns the number of divisors of that number. For example, if you send 15 to…
- 7) You wish to place the following code inside of a loop:x++;Which of the following loops would guarantee that the code is always executed at least once?A) While B) Do while C) For D) GotoThe 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;Pls do flowchart for this // This pseudocode is intended to determine whether students have // passed or failed a course; student needs to average 60 or // more on two tests. start Declarations num firstTest num secondTest num average num PASSING = 60 // input of first test score output "Enter first score or 0 to quit " input firstTest // loop that continues until the user enters 0 as first test score while firstTest not equal to 0 // input of second test score output "Enter second score or 0 to quit" input secondTest // if second test score is not 0 then calculate and display average and display if the student passed or failed if secondTest is not equal to 0 // calculate and display average average = (firstTest + secondTest) / 2 output "Average is ", average misspelled "t" for the word output // determine if the student passed or failed…
- 2. Task 1: Using do-while loop Write a do-while loop which validate and evaluate the input value for variable grade. NOTE:The program will force the user to enter a valid grade.When the user enter a valid grade, the program will evaluate the grade as passing or failing grade.When the user enter an invalid grade, the program will only allow 3 invalid grade input.Valid grade is from 0 to 100 only.Passing grade is from 70 to 100.Failing grdae is from 0 to 69. NOTE:Your source code must display any of the given sample output below.It means your source code should be flexible enough to meet any of the given sample output.Your source code output must be identical to any of the given sample output.It means you have to strictly follow what are the displayed text, labels, casing of characters in the sample output. OUTPUT 1 Enter Grade: 100 Remark: Passed OUTPUT 2 Enter Grade: 69 Remark: Failed OUTPUT 3 Enter Grade: -1 Remark: Invalid Enter Grade: 101…Budget Analysis (Running Total)Write a program BudgetAnalysis.py) that asks the user to enter the amount of money that he or she has available to spend on electronics this year. A loop should then prompt the user to enter each of his or her expenses for electronics and keep a running total. When the loop finishes, the program should display the total amount that the user spent, and analyse if there is still money to buy more electronics. Here are two test runs of the program: Enter your available amount for electronics in 2020: 1500 Enter your expense (-1 for stop): 340 Enter your expense (-1 for stop): 450 Enter your expense (-1 for stop): -1 So far you spent $ 790.0 You can buy more electronics. >>> ========= RESTART: C: \Users \Rita \Desktop \Lab5-1 B BudgetA Enter your available amount for electronics in 2020: 900 Enter your expense (-1 for stop): 730 Enter your expense (-1 for stop): 290 Enter your expense (-1 for stop): -1 So far you spent $ 1020.0 No more electronics in…1.Convert the while loop in the following program to for loop. #include int main() { Int num rem,reverse_num3%3; printf("nEnter any number:"); scanf("%d",&num); while(num>=1) { rem=num%10; reverse_num=reverse num*10+rem; num=num/10; printf(nReverse of input number is:%d",reverse_num); return 0:
- Question#2. The distance a vehicle travels can be calculated as fallout: Distance = Speed * Time For example, if a train travels 60 miles-per-hour for three hours, the distance [raveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph far a three-hour time period, it should display a report similar to the one chat follows: Hour Distance Traveled 1 90 2 100 3 150 Input Validation: Do not accept a negative number for speed and do not accept any value les than 1 for time traveled.Is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times For-loop O .While O .Switch OLooping 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: