*****
*****
*****
*****
*****
/*
* C program to print mirrored Rhombus star pattern series
* atnyla.com
*/
#include <stdio.h>
int main()
{
int i, j, N;
/* Input number of rows from user */
printf("Enter rows: ");
scanf("%d", &N);
for(i=1; i<=N; i++)
{
/* Print trailing spaces */
for(j=1; j<i; j++)
{
printf(" ");
}
for(j=1; j<=N; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Enter rows: 5
*****
*****
*****
*****
*****
*****
*****
*****
*****
*****
The above pattern contains N rows and each row contains N columns (where N is total rows to be print). If you have noticed there are i - 1 spaces per row (where i is current row number). You can hover or click on to the above pattern to see or count total spaces per row.
Step by step descriptive logic to print mirrored rhombus star pattern.
for(i=1; i<=N; i++).i - 1 with structure for(j=1; j. Inside this loop print single blank space.for(j=1; j<=N; j++). Inside this loop print star.First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.