这是一个四边形,其中两对对边是平行的。
有六个重要的平行四边形属性需要了解
// 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; }
以上是在C语言中编写一个打印镜像空心平行四边形的程序的详细内容。更多信息请关注PHP中文网其他相关文章!