题目描述
找出杨辉三角形的规律,并根据输入n(1≤n≤100)总行数,输出对应的数字图形(先生成再输出,每个数据所占场宽为4)。
杨辉三角前10行
算法分析:杨辉三角的规律为:左右两边数字均为1,每行数字左右对称,第n行的数字有n项,由1开始逐渐变大,中间的每个数均等于它上方两数之和。
参考程序及运行结果:
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.