star-pattern-1

About this program:

This C program will print a simple star patterned rectangle. It won’t take any input from the user.
This pattern consists of 5 rows and 5 columns.

Logic:

Here we are going to use 2 “for..loops”. One for rows and one for columns. You can see the detailed explanation of this pattern here.

Code:

OUTPUT

You can adjust the shape of this pattern by printing some spaces. For example, if you want it to look like a square, just add an extra space after ‘*’. Like this:

 

C program to print simple star pattern rectangle
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *