原始问题:
帮我用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;}
Prev:画一个上学的小姐姐