首页 > 其他分享 >C: print rhombus

C: print rhombus

时间:2023-03-20 23:56:01浏览次数:28  
标签:int rhombus ++ printf print line include

 

#include <stdio.h>
#include "math.h"
#include "stdlib.h"
#include "unistd.h"

int main(void) {
    int h, line, t;
    scanf("%i", &h);
    for (int v = h - 1; v >= -(h - 1); --v) {
        line = h - abs(v);
        for (t = 0; t < h - line; ++t)
            printf(" ");
        for (t = 0; t < 2 * line - 1; ++t) {
            if (t == 0 || t == 2 * line - 1 - 1)
                printf("*");
            else
                printf(" ");
        }
        printf("\n");
    }
}

 

标签:int,rhombus,++,printf,print,line,include
From: https://www.cnblogs.com/dissipate/p/17238455.html

相关文章