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.