1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhuklara [117]
3 years ago
11

Write a C++ nested for loop code to print out the following onthe screen1 2 3 4 5 67 8 91 2 3 4 5 67 81 2 3 4 5 671 2 3 4 561 2

3 451 2 341 23121
Computers and Technology
1 answer:
Mekhanik [1.2K]3 years ago
6 0

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   

  //nested for loop

   for(int i=9;i>=1;i--){

       for(int j=1;j<=i;j++){

          cout<<j<<" ";  //display

       }

   }

   return 0;

}

Explanation:

Include the library iostream for using the input/output instruction in the c++ programming.

Create the main function and takes nested for loop. Nested for loop means, for loop inside the another for loop.

For every value of outside for loop, inside for loop execute.

we make outer for loop in decreasing format, means it start from 9 and goes to 1 and inside for loop make in increasing format, means loop start from 1 and it goes to that value which is provided by the outer loop.

and print the output for every cycle.

Lets dry run the code:

the outer loop starts from 9 and it checks the condition 9>=1, condition true. then the program moves to the inner loop which starts from 1 and goes to the 9.

first, it also checks the condition 1 <= 9, condition true and prints the number from 1 to 9.

then,  i is reduced by 1. it means i become 8.

then, the above process continues from 1 to 8 and so on...

the loop process will terminate if the outer loop terminate.

Finally, we get the output.

You might be interested in
You are working at establishing a computer network and communications support for incident personnel. where are you working?
katovenus [111]
C operations section is where you would be working
8 0
3 years ago
Binary is best interpreted by a computer because ​
Nookie1986 [14]
Because it is the back-end programming. It is the basis of all of the other computer languages and allows the computer to function.
8 0
3 years ago
Read 2 more answers
Logic errors are easily identified when a program is compiled true or false
lord [1]
<span>A compiler executes each program statement as soon as it is translated.
</span>The statement that logic errors are easily identified when a program is compiled is false, because the compiler locates only syntax errors, but logic errors <span>can be eliminated only through careful examination of your program. </span>
Logic errors are usually more difficult to find and resolve than syntax errors.


7 0
3 years ago
Read 2 more answers
Which of the following should NOT be done to keep people from slipping on floors?
irina [24]

you should not leave them to air dry

5 0
3 years ago
What part of the interface displays the external references contained in a selected cell? the status bar the Review tab the scro
gulaghasi [49]

The formula bar

In Excel, external references reference a cell or a range of cells in another workbook. The formula of an external reference result can be displayed in a formula bar. A formula bar displays the value or formula entered in an active cell. It displays information being entered as you type in the active or current cell. Contents of an external reference can also be edited in the formula bar.

4 0
3 years ago
Other questions:
  • What's the best way to change the font size of all your notes pages at once?
    14·2 answers
  • What hernia repair codes can be reported with add-on code 49568?
    6·1 answer
  • The What is the pathname that starts from the working directory. directory?
    7·1 answer
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • An identifier that is prefixed with an @ and allows you to use code written in other languages that do not have the same set of
    8·1 answer
  • Differentiate between inherited trait and acquired trait​
    12·1 answer
  • Design by contract considers the software system to be a setof:
    10·1 answer
  • Reflect on your semester in this class analysis and Design from an overall "experience" perspective
    9·1 answer
  • Q.No.3 b. (Marks 3)
    5·1 answer
  • You have purchased a new LED monitor for your computer. On the back of the monitor, you see the following port (pictured below).
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!