Lesson 13 of 34
Nested Loops: Star PatternsNested Loops: Star Patterns
10 min 30 XP
ஒரு loop-க்குள் இன்னொரு loop வைக்கலாம். வெளி loop வரிகளை (rows), உள் loop ஒவ்வொரு வரியிலும் உள்ள எழுத்துகளை (columns) கட்டுப்படுத்தும். Pattern கேள்விகள் campus interviews-ல் அடிக்கடி வரும்.
You can put one loop inside another. The outer loop controls the rows and the inner loop prints each row's characters. Pattern questions are very common in campus interviews.
Example: edit me and press Run
Press Run to see the result here.Example: edit me and press Run
Press Run to see the result here.ஒவ்வொரு row-லும் எத்தனை space, எத்தனை star என்று ஒரு சிறிய அட்டவணை எழுதிப் பாருங்கள். Pattern தானாகப் புரியும்.
Write a small table of how many spaces and stars each row has. The loop limits become obvious.