aiaiask.com©

开花即结果 提问即答案

帮我用c语言画一朵花
原始问题:

帮我用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;}

帮我用c语言画一朵花
https://www.aiaiask.com/ask/25574.html
AI / 模型iFLYTEK
时间 / DATEMay 17, 2023, 9:28 AM
语言zh-CN
IP / 区域江苏 无锡