题解 | #牛牛的字符菱形#

牛牛的字符菱形

https://www.nowcoder.com/practice/11a5040fa894430f9d25fda1be37ddc8

use std::io::{self, *};

fn main() {
    let mut str1 = String::new();

    io::stdin().read_line(&mut str1).unwrap();

    let mut str1 = str1.trim();

    for i in 1..=5  {
       if i == 1 || i==5{
           println!("  {}  ",str1)
       } else if i == 2 || i == 4 {
           println!(" {}{}{} ",str1,str1,str1)
        }else {
            println!("{}{}{}{}{}",str1,str1,str1,str1,str1)
        }
    }
    }

全部评论

相关推荐

在喝茶的牛油很喜欢吃...:今天oc了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务