Skip to content

Opening book details…

About this document

Star by sikhni is a document available to read on EtoBox.

This short code prints a pattern of stars in the shape of a pyramid. It uses nested for loops, with the outer loop iterating from 1 to 4 and the inner loop iterating from 1 to the current value of the outer loop counter. Each iteration of the inner loop prints a star followed by four spaces, and after the inner loop finishes it prints a new line. This prints a pyramid of stars with 1 star on the first line, 2 stars on the second line, and so on up to 4 stars on the fourth line.

Author
sikhni
Language
EN