Lesson 10 of 23

Nested Loops: Patterns

10 min 30 XP

बाहेरचा loop rows हाताळतो आणि आतला loop प्रत्येक row ची अक्षरे print करतो. Campus tests ना pyramids आणि diamonds खूप आवडतात.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Pyramid मध्ये row r मध्ये (n - r) spaces आणि (2r - 1) stars असतात. आधी तक्ता बनवा, मग loops लिहा.

Challenge

+30 XP

n वाचा आणि हा उलटा त्रिकोण print करा (n = 4): **** *** ** *

Output Loading C (first time takes a few seconds)
Press Run to see the result here.