这是一个四边形,其中两对对边是平行的。

有六个重要的平行四边形属性需要了解

// 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语言免费学习笔记(深入)”;

以上就是在C语言中编写一个打印镜像空心平行四边形的程序的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号