********
********
********
********
********
********
********
********
********
/*
* C program to print mirrored parallelogram star pattern series
*/
#include <stdio.h>
int main()
{
int i, j, M, N;
/* Input number of rows and columns */
printf("Enter rows: ");
scanf("%d", &M);
printf("Enter columns: ");
scanf("%d", &N);
for(i=1; i<=M; i++)
{
/* Print trailing spaces */
for(j=1; j<i; j++)
{
printf(" ");
}
for(j=1; j<=N; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Enter rows: 6
Enter columns: 7
*******
*******
*******
*******
*******
*******
Press any key to continue . . .
********************
********************
********************
********************
********************
Logic to print mirrored parallelogram star pattern is same as of mirrored rhombus star pattern. The only change we need to make is we need to iterate though M rows and N columns (where M is the total number of rows to print and N is total number of columns to print).
First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.
After understanding this example, try to rewrite the same program without looking at the code. Then change some values or logic and run it again. This helps improve confidence and keeps learners engaged on the page for longer.