logo CodeStepByStep logo

starsPrint

Language/Type: C++ expressions %

What output is produced by each of the following code samples?

// A)
for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 10; j++) {
        cout << "*";
    }
    cout << endl;   // to end the line
}
// B)
for (int i = 1; i <= 5; i++) {
    for (int j = 1; j <= i; j++) {
        cout << "*";
    }
    cout << endl;
}
// C)
for (int i = 1; i <= 5; i++) {
    for (int j = 1; j <= i; j++) {
        cout << i;
    }
    cout << endl;
}
A)
B)
C)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.