标签:bsp 技术 stdio.h eof string printf blog 思考 har
思考:杨辉三角形
#include<stdio.h> #include<cstring> int main() { int n; char d; int a[31][31] = {0}; while (scanf_s("%d%c",&n,&d)!=EOF) { a[0][1] = 1; int i; for (i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { a[i][j] = a[i - 1][j - 1] + a[i - 1][j]; printf("%d", a[i][j]); if (j < i) printf(" "); } printf("\n"); } printf("\n"); } }
标签:bsp 技术 stdio.h eof string printf blog 思考 har
原文地址:http://www.cnblogs.com/Strugglinggirl/p/5988954.html