Lesson 10 of 23

Nested Loops: PatternsNested Loops: Patterns

10 min 30 XP

வெளி loop rows, உள் loop ஒவ்வொரு row-ன் எழுத்துகள். Campus tests-ல் pyramid, diamond போன்ற patterns அடிக்கடி கேட்பார்கள்.

The outer loop handles rows and the inner loop prints each row's characters. Campus tests love pyramids and 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. முதலில் அட்டவணை போடுங்கள், பிறகு code.

In a pyramid, row r has (n - r) spaces and (2r - 1) stars. Make the table first, then write the loops.

Challenge

+30 XP

n-ஐப் படித்து இந்த தலைகீழ் triangle-ஐ print செய்யுங்கள் (n = 4): **** *** ** *

Read n and print this inverted triangle (n = 4): **** *** ** *

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