# Answer to Question #57146 in C++ for priyam

Question #57146

Find the output of the following program.... and please explain the output..........

int main()

{

randomize();

int NUM;

NUM = random(3) + 2;

char TEXT[] = "ABCDEFGHIJK";

for (int I = 1; I <= NUM; I++)

{

for (int J = NUM; J <= 7; J++)

cout << TEXT[J];

cout << end1;

}

}

int main()

{

randomize();

int NUM;

NUM = random(3) + 2;

char TEXT[] = "ABCDEFGHIJK";

for (int I = 1; I <= NUM; I++)

{

for (int J = NUM; J <= 7; J++)

cout << TEXT[J];

cout << end1;

}

}

Expert's answer

Function randomize() reset generator of random numbers. So, since random create number from 0 to 2, NUM can be from 2 to 4.

In the next line we start cycle from 1 to NUM, in which we output symbols from NUM to 7 (so, we output 7-NUM+1 characters, which start from C (or D or E) and continues to H.

So, we have from 2 to 4 lines, each line contain symbols from C(or D or E) to H, and this lines a same

For example, it can be:

EFGH

EFGH

EFGH

EFGH

Or

DEFGH

DEFGH

DEFGH

In the next line we start cycle from 1 to NUM, in which we output symbols from NUM to 7 (so, we output 7-NUM+1 characters, which start from C (or D or E) and continues to H.

So, we have from 2 to 4 lines, each line contain symbols from C(or D or E) to H, and this lines a same

For example, it can be:

EFGH

EFGH

EFGH

EFGH

Or

DEFGH

DEFGH

DEFGH

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment