Lesson 13 of 34

Nested Loops: Star Patterns

10 min 30 XP

एक loop को दूसरे के अंदर रख सकते हैं। बाहरी loop rows संभालता है और अंदरूनी loop हर row के अक्षर print करता है। Campus interviews में pattern सवाल बहुत आम हैं।

Example: edit me and press Run

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

Example: edit me and press Run

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

हर row में कितने spaces और stars हैं, इसकी एक छोटी तालिका बनाएँ। Loop की सीमाएँ अपने-आप साफ़ हो जाएँगी।

Challenge

+30 XP

n पढ़ें और यह संख्या त्रिभुज print करें (n = 4): 1 1 2 1 2 3 1 2 3 4

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