一、N-S流程图;
二、运行结果;
三、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
int main()
{
//初始化变量值;
int i = 0;
int k = 0;
int j = 0;
//打印上半部分;
for (i = 1; i <= 4; i++)
{
//打印空格;
for (j = 1; j <= 4 - i; j++)
{
printf(" ");
}
//打印*;
for (k = 1; k <= 2 * i - 1; k++)
{
printf("*");
}
//换行;
printf("\n");
}
//打印下半部分;
for (i = 1; i <= 3; i++)
{
//打印空格;
for (j = 1; j <= i; j++)
{
printf(" ");
}
//打印*;
for (k = 1; k <= 2 * (3 - i) + 1; k++)
{
printf("*");
}
//换行;
printf("\n");
}
return 0;
}