Home > Article > Backend Development > Write a program in C language to print a mirrored hollow parallelogram
This is a quadrilateral in which two pairs of opposite sides are parallel.
There are six important parallelogram properties to know
// C program to print mirrored hollow parallelogram #include <stdio.h> int main(){ int rows,cols,r,c; clrscr(); /*Clears the Screen*/ printf("Please enter the number of Rows: "); scanf("%d", &rows); printf("</p><p>"); printf("Please enter the number of Columns: "); scanf("%d", &cols); printf("</p><p>"); printf("The Mirrored Hollow Parallelogram is: "); printf("</p><p>"); for(r = 1; r <= rows; r++){ // Display spaces for(c = 1; c < r; c++) { printf(" "); } // Display hollow parallelogram for(c = 1; c <= cols; c++) { if (r == 1 || r == rows || c == 1 || c == cols) { printf("*"); } else { printf(" "); } } printf("</p><p>"); } getch(); return 0; }
The above is the detailed content of Write a program in C language to print a mirrored hollow parallelogram. For more information, please follow other related articles on the PHP Chinese website!