Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 5 students

Java Nested Loop Output

< Prev
Next >

What is printed when the following code segment is executed?

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();
}
A

*–
**-


B

–*
-**


C

-**
–*

D

–*


–*

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1hitrishabhatia13 0m 00s 80
#2y.seong202712 0m 56s 34
#3kazvin.tjakradinata22 2m 49s 31
#4suhanakochhar00612 2m 22s -52
#5chunxiangxu.cxu01 8m 56s -546
#6namansoin00001 15m 44s -954
#7bommasam00037 1h 28m -5,067
Items per page:
10
1 – 7 of 7
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ