Use nested for loops statements to draw triangles of "*"s. The number of "*"s on the last row is input from the user (valid range: 5 to 21). Sample output: Drawing triangles program. ========================== How many triangles? 2 How many stars/last row (5-21)? 25 Out of range. Reenter: 7 * ** *** **** ***** ****** ******* How many stars/last row (5-21)? 5
Q: describe this code: When run: Set length to 150 repeat 3 times do: movie forward by length…
A: In the given question , we need to describe each code and we need to mention what is happening in…
Q: A triangle is considered valid if the sum of each 2 sides is greater than the remaining third side.…
A: We have to write a program a program that takes the length of three sides and print "equilateral",…
Q: > Write a complete program to print the number of days in a given month entered from the keyboard.…
A: I have given an answer in step 2.
Q: 1. Sind Ask the user to input the triangle size (in main) a Your program should work for any…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: I am trying to get the program to prompt the user to put in input and then ask again. I think I…
A: In the given C++ program, An integer type variable is declared. The do-while loop contains only one…
Q: A palindrome is a word or a phrase that is the same when read both forward and backward. Examples…
A: The source code for the above program is given below along with the comments to have a better…
Q: Write an LMC program that generates the Fibonacci series. Write a Little Man program that prints…
A: LMC Program that generates the Fibonacci series Answer : Code: INP STA N LOOP LDA…
Q: A palindrome is a word or a phrase that is the same when read both forward and backward. Examples…
A: Given: To write python code.
Q: Homework write a program that will add the terms of an infinite geometric series. The program should…
A: correct Code:-
Q: Divide by x Write a program using integers user_num and x as input, and output user_num divided by x…
A: Given data If the input is: 2000 2 Then the output is: 1000 500 250
Q: (Find the number of days in a month) Write a program that prompts the user to enter the month and…
A: Given :- Write a program that prompts the user to enter the month and year anddisplays the number of…
Q: The tuition for a private university is X riyals this year. Tuition fee increases 5% every year.…
A: The Answer is
Q: 3. Write a program that accepts two input numbers and compute the Greatest Common Divisor using…
A: #include <iostream>using namespace std; int main(){ char ch; int n1, n2; do {…
Q: Fill in the blank: Z=0 i=4 x-int(input("Enter any number")) while i<=n: Z=Z+i/i+1 print(z) i=i+1 for…
A: Refer to step 2 for the answer.
Q: Exercise Based on problem in examplel, represent the algorithm by using flowcharting technique.…
A:
Q: Please modify the following code to use only the DO-WHILE loops. The program prompts a user for an…
A: Code: #include<stdio.h>main(){ int size = 0;int i=0;int j = 0;printf("enter…
Q: Q3/ write a Math-lab program by using for statements loop in same time with while statements loop.…
A: The FOR loop is nicer and more compact if the number of iterations is known before the loop is…
Q: A palindrome is a word or a phrase that is the same when read both forward and backward. Examples…
A: Simple Algorithm: Step1: Start. Step2:Read the string from the user. Step3: Calculate length of the…
Q: program that prompts for the number of rows and then uses nested loops to print the output as shown…
A: java program us as given below : = class Main { public static void main(String[] args) { int…
Q: Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q…
A: Please find the answer below :
Q: Retype the below code. Fix the indentation as necessary to make the program work. if 'New York' in…
A: Program code: temperatures={'New York':105,'Washington':95,'California':115,'Las Angeles':90} if…
Q: rite a program using for statement to enter 3 numbers then use switch case to do he following based…
A: Note: Since you have not provided the language name to write the code. So I am using java language…
Q: # Complete the following program num_in_tens = int(input('Enter the tens digit:\n')) num_in_ones =…
A: num_in_tens = int(input('Enter the tens digit:\n'))num_in_ones = int(input('Enter the ones…
Q: Question4: Write a program to take input an integer n followed by n integers. Program should check…
A: According to the Question below the Solution; Output:
Q: /** * Given two integers, the second larger than the first, this program: * 1) prints the even…
A: The below given Java program will obey the following rubrics: Importing required data package.…
Q: A cloth showroom has announced the following seasonal discounts on purchase of items: Total price…
A: Since, you have not specified the language. The below code is in python language. The algorithm used…
Q: Enter number of month M (1 January,..., 12 December): 6 Enter number of day D: 30 The zodiac sign is…
A: Here is the approach : Take input for the date and month Create the function to get the number of…
Q: Finish the program to compute how many gallons of paint are needed to cover the given square feet of…
A: Algorithm Start Var area, c Accept input from user in variable area c = area/350 Print ("# of…
Q: ***python only*** What is output of the following program, if the user input are x=5 and y=11? def…
A: def main() : x = int(input('Enter value for x:')) y = int(input('Enter value for y:')) c…
Q: palindrome is a word or a phrase that is the same when read both forward and backward. Examples are:…
A: Please find the answer below :
Q: 3. Use nested for loops statements to draw hallow boxes of "*"s. The boxes have the same number of…
A: EXPLANATION -- In this program firstly we will display drawing hallow boxes and a line and then we…
Q: A person is eligible to be a US senator if they are at least 30 years old and have been a US citizen…
A: PROGRAM EXPLANATION Take personage and years of citizenship as input from the user. Now, using the…
Q: QUESTION#4: Write a program that input a number n and then input n numbers. The program must…
A: //importing packageimport static java.lang.Float.sum; //importing packageimport java.util.Scanner;…
Q: Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q…
A: import java.util.Scanner;public class Main{public static void main(String[] args) { String…
Q: Convert the following for loop statement to while and do … while statement int total = 0; for (int…
A: while statement: int count=0; while(count<=30) { total += count; count++; }
Q: Print following hourglass figures using loops, System.out.print( "*" ), System.out.print( " " ),…
A: 1) Below is JAVA Program to display hourglass figures using loops, System.out.print( "*" ),…
Q: Write a program that inputs the hourly rate and number of hours worked. Compute and display the…
A: Here I have taken input from the user and then stored it into 2 different variables. Next, I have…
Q: Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features." If 1970…
A: As No coding language is provided, giving the code in c++: #include <iostream>using namespace…
Q: Write a for loop to over the ten numbers 0 through 9 and print these out to produce the output:
A: Program Code: for i in range(0,10): print("i =",i)
Q: Create a new version of the program below that uses Boolean expressions (not true of false) for…
A: A boolean expression is an expression that yields just the two outcomes: true or false. To relate…
Q: Homework write a program that will add the terms of an infinite geometric series. The program should…
A: Here is the code with output:-
Q: Modify the given program to only accept an arrow head width that is larger than the arrow base…
A: /* Program after modification */ import java.util.*; //Main function public class Main{ public…
Q: A variable like user_num can store a value like an integer. Extend the given program as indicated.…
A: CODE:- # Take first number as input from the user user_num = int(input('Enter integer: ')) #…
Q: 1.Convert the while loop in the following program to for loop. #include int main() Int…
A: #include<stdio.h>int main(){int i,num,rem,reverse_num=0;printf("Enter any…
Q: monthly paycheck for an employee. pay is calculated after taking the following deductions: a)…
A: PROGRAM: //Importing header import javax.swing.JOptionPane; //Defining class class…
Q: 2. Use nested for loops statements to draw triangles of "*"s. The number of "*"s on the last row is…
A: Since the programming language is not mentioned in the question, we will answer this question in the…
Q: Write a program that uses nested loops to draw the pattern below. You are not allowed to use any of…
A: Given, The symbol to be used = "$" user-defined integer variable n is declared for…
==========================
How many triangles? 2
How many stars/last row (5-21)? 25
Out of range. Reenter: 7
**
***
****
*****
******
*******
**
***
****
*****
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Create class name whileloopActivity and write a program to produce the following output using nested while loops3. Use nested for loops statements to draw hallow boxes of "*"s. The boxes have the same number of rows and columns and this number should be input from the user (valid range: 5 to 21). Sample output: Drawing hallow boxes program. Do you want to start (Y/N) ? Y How many rows/columns (5-21) ? 25 Out of range. Reenter: 7 ******* * * * * *******3. The Math subtraction learning tool program generates just one question for each run. You can use a loop to generate questions repeatedly. Therefore, write a program that generates five questions and reports the number of the correct answers after a student answers all five questions. (The output of your program should be like the following but you should try different numbers) What is 9 -27 7 You are correct! What is 307 3 You are correct! What is 3 27 1 You are correct! What is 7- 47 4 Your answer is wrong. 7- 4 should be 3. What is 757 4 Your answer is wrong. 7- 5 should be 2 Correct count is 3 Test time is 1021 seconds 9-2-7 correct 3-0-3 correct 3-2-1 correct 7-4-4 wrong 7-5-4 wrong
- (Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.1. Write a program called NumberGuess to play the number guessing game. The program shall generate a random number between 0 and 99. The player inputs his/her guess, and the program shall respond with "Try higher", "Try lower" or "You got it in n trials" accordingly.Accumulating Totals in a Loop Summary In this lab, you add a loop and the statements that make up the loop body to a Java program that is provided. When completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. Your loop should execute until the user enters the character X instead of L for left-handed or R for right-handed. The inputs for this program are as follows: R, R, R, L, L, L, R, L, R, R, L, X Variables have been declared for you, and the input and output statements have been written. Instructions Ensure the file named LeftOrRight.java is open. Write a loop and a loop body that allows you to calculate a total of left-handed and right-handed people in your class. Execute the program by clicking Run and using the data listed above and verify that the output is correct.
- Three numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasingUse While loop to solve the problems Note: Python language for solution 4. Write a program that uses a while loop, the program should do the following: The program should repeatedly read numbers until the user enters "done". Once "done" is entered, print out the total, count, and average of the numbers. 5. Write a program to find the sum of even numbers until n, where n is an int entered by the user, example: n = 11, sum = 2+4+6+8+10, sum = 30.By using while loop OR do..while loop, write a program that displays a list of groceries. Then, allow user to insert number of product that they want to buy, the item's code and quantity for each item. Finally, display the total price that the user needs to pay. Valid input for the number of product and quantity is positive number. Meanwhile valid number for items' code is only from 1 to 4. 1 Cooking oil 2 Curry powder RM 3.40 3 Detergent Potato chips RM 2.50 RM 8.50 4 RM 3.20 Sample output Emer number of product that you want to purchase (press 0 to exit) : 2 1.Enter item's code that you want to buy : 3 1.Enter the quantity of item that you want to buy: 1 2.Enter item's code that you want to buy : 0 2.Enter the quantity of item that you want to buy: 0 2.Enter item's code that you want to buy : 1 2.Enter the quantity of item that you want to buy; 2 Total price is RM 13.50
- 4- Write a program that reads the average of 30 students and find the number of pass students , the number of fail students then print the results. 5- Write a program that reads 20 numbers then find the number of negative and positive numbers and the number of numbers equal to zero and print the results. 6- Write a program to read three numbers A,B,C then find whether A,B,C can form the sides of a triangle, if yes compute the parameter of the triangle , if no print the massage ( not a triangle), then determine whether A,B,C form the side of an (a)) equilateral triangle ,b) isosceles triangie ,c)) right angle triangle Hint: ( A,B,C can form a triangle if each side is less than the sum of the other two sides)Program Sample outputs Amount°you°wish•to°prepay:°$844 With $84°you°can•buy°6 meals and•will have°a•balance°of°$6. Amount°you®wish to°prepay:°$1954 With $195°you°can•buy°15°meals and•will•have°a•balance°of°$0.1. Write a program that asks the user for the price of several items sold until the user answers with an “N”. The program should accumulate the total of all prices entered. After the loop is finished, the program is to compute the sales tax of all items as 7% [0.07]. Finally, the program is to print out the total of the items, the sales tax due, and the total amount due on three separate lines.
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)