| preferred AP College board partner for AP classes
medium Solved by 7 students
Java Nested Loop Output
< Prev
Next >

Consider the following code segment.

for (int r = 3; r > 0; r--)
{
    int c;
    
    for (c = 1; c < r; c++)
    {
        System.out.print("-");
    }
    
    for (c = r; c <= 3; c++)
    {
        System.out.print("*");
    }
    
    System.out.println();
}

What is printed as a result of executing the code segment?

A

-**
–*

B

–*


–*

C

*–
**-


D

–*
-**


Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hitrishabhatia13 0m 00s 80
#2y.seong202712 0m 56s 34
#3kazvin.tjakradinata22 2m 49s 31
#4suhanakochhar00612 2m 22s -52
#5namansoin00001 15m 44s -954
#6bommasam00037 1h 28m -5,067
Items per page:
10
1 – 6 of 6

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy