#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<Windows.h>
int main()
{
int rows, i, j, space;
printf("请输入菱形的行数:");
scanf("%d", &rows);
for (i = 1; i <= rows; i++)
{
for (space = 1; space <= rows - i; space++)
{
printf(" ");
}
for (j = 1; j <= 2 * i - 1; j++)
{
printf("*");
}
printf("\n");
Sleep(200);
}
for (i = rows - 1; i >= 1; i--) {
for (space = 1; space <= rows - i; space++)
{
printf(" ");
}
for (j = 1; j <= 2 * i - 1; j++)
{
printf("*");
}
printf("\n");
Sleep(200);
}
return 0;
}
标签:main,rows,space,int,打印,菱形,include
From: https://blog.51cto.com/u_16425777/8862626