Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the needed code to make the program runs correctly. The program prompts the user to input a non-zero positive integer, then prints out the

Write the needed code to make the program runs correctly.

The program prompts the user to input a non-zero

positive integer, then prints out the patterns shown

in the sample runs below.

You must use repetition structure such as for-loop or

while-loop.

The sample runs are as follows.

Sample Run 1:

Key in an integer +ve value: 7

7

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4 5 6 7

Sample Run 2:

Key in an integer +ve value: 15

15

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4 5 6 7

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9 10

1 2 3 4 5 6 7 8 9 10 11

1 2 3 4 5 6 7 8 9 10 11 12

1 2 3 4 5 6 7 8 9 10 11 12 13

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

---------------------------------------------------------------*/

#include

#include

using namespace std;

//-------------------------------------------------

// write your function drawPattern below this line

//-------------------------------------------------

//-------------------------------------------------

// your code ends here.

//-------------------------------------------------

//IMPORTANT:

// Don't modify anything below this line.

// any changes to the lines below will cause

// you to loose the mark for the question

int main()

{

unsigned int n;

cerr << "Key in an integer +ve value: ";

cin >> n;

cout << n << endl;

drawPattern(n);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago

Question

Write down the Limitation of Beer - Lamberts law?

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago