题解 | #打印等腰三角形#

打印等腰三角形

https://www.nowcoder.com/practice/1c55ca2b73a34e80bafd5978810dd8ea

#!/bin/bash
# read n;
# awk -v n=$n 'BEGIN{
# for(i = 1; i <= n; ++i){
#     row[i] = "";
#     for(j = 1; j <= n-i; ++j){
#         row[i] = row[i] " ";
#     }
#     for(k = 1; k <= i; ++k){
#         row[i] = row[i] "* ";
#     }
#     print row[i];
# }
# }'
read n;
awk -v n=$n 'BEGIN{
for(i = 1; i <= n; ++i){
    row[i] = "";
    for(j = n-i; j >= 1; --j){
        row[i] = row[i] " ";
    }
    for(k = 1; k <= i; ++k){
        row[i] = row[i] "* ";
    }
    print row[i];
}
}'

#你觉得今年春招回暖了吗##23届找工作求助阵地##我的实习求职记录##零基础学习C++#
全部评论

相关推荐

挣K存W养DOG:他真的很中意你,为什么不回他
点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务