i. Enter answers to the following five questions by using complete sentences. To
ID: 3735216 • Letter: I
Question
i. Enter answers to the following five questions by using complete sentences. Topic: (05CH5) Discussion: Nest 1. What is a nested loop? 2. Create a mini-program, using nested loops to create a rectangle, square, right triangle, equilateral triangle, etc...Choose any shape. Copy and Paste the code for your program below any shape. Copy and Paste the code for your The example shown below is a rectangle, but feel free to create any shape. The rectangle shown below has 3 rows and 5 columns. The 3 and 5 should be stored in variables and the loop should use those values/variables. For example: rows-3; for (r-1; rExplanation / Answer
Ans 1. A nested loop is a loop within a loop. For example, consider the pseudo code in java language below:
for(int i =0; i< 20; i++){ //loop 1 starts
for(int f = 0: j <10; j ++){ //nested loop starts
//some logic
}
}
Description: In the code above, the first for loop iterates for 20 times. For each number 1 through 20 again 10 iterations occurs, which is the nested loop. Here i and j are random variables or counters to count the number of times the loop iterates.
//Equilateral Triangle
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.