打印菱形
程序员文章站
2024-03-23 18:42:52
...
#include<stdio.h>
#include<stdlib.h>
int main() {
for (int i = 1;i <= 7;i++) {
for (int n = 1;n <= 7 - i;n++) {
printf(" ");
}
for (int j = 1;j <= 2*i-1;j++) {
printf("*");
}
printf("\n");
}
for (int i = 6;i >= 1;i--) {
for (int n = 1;n <= 7 - i;n++) {
printf(" ");
}
for (int j = 1;j <= 2*i-1 ;j++) {
printf("*");
}
printf("\n");
}
system("pause");
return 0;
}