题解 | #打印乘法表#

打印乘法表

https://www.nowcoder.com/practice/4c1ec287030d4ca1be63b258f88ebcc1

#include <iostream>
using namespace std;

int main() {

    int n;
    cin >> n;

    //i表示乘法表行数.
    for (int i = 1; i <= n; i++) {
        //j表示乘法表列数
        for (int j = 1; j <= i; j++) {
            //按对应格式输出乘法表
            cout << j << " * " << i << " = " << j* i << "    ";
        }
        //每打印完一行,进行换行
        cout << endl;
    }

    return 0;
}

全部评论

相关推荐

2025-12-13 14:51
已编辑
井冈山大学 算法工程师
龙虾x:算法比你强的没有你美,比你美的…..算了已经没有比你美的了
工作两年想退休了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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