c-hollow-star-pattern

About this program:

This program generates a hollow rectangular box pattern which contains only stars. Unlike the previous program, here we are going leave the inner  portion blank. This program will contain 6 rows and 6 columns. This pattern will look something like this:

Logic:

Here in this program, we are going to use two “for..loops”. One for rows and one for columns. But the condition is, we will only print ‘*‘, if i ==6 or j==6 or i==6 or j==6. Otherwise,  a blank space will be printed.
If you need a more detailed explanation, please see this java program on the same pattern.

Code

Output

 

Hollow rectangular shaped star pattern – C Program
Tagged on:

Leave a Reply

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