帮我用c语言画一朵花
#include <stdio.h>
int main()
{
int row, c, n, s;
printf("Enter the number of rows
");
scanf("%d", &n);
s = n - 1;
for (row = 1; row <= n; row++)
{
for (c = 1; c <= s; c++)
printf(" ");
s--;
for (c = 1; c <= 2*row - 1; c++)
printf("*");
printf("
");
}
s = 1;
for (row = 1; row <= n - 1 ; row++) // loop to print upper triangle. //loop to print lower triangle. // decrementing the value of k after each loop. { for (c = 1 ; c <= s ; c++ ) printf(" "); s++; for (c = 1 ; c <= 2*(n-row) -1 ; c++ ) printf("*"); printf("
"); } return 0;}
免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。