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.