#include <iostream>
#include <iomanip>
using namespace std;
#define N 15
#define S 128
int main () {
int mas[S];
for(int n = 0; n < N; n++) {
mas[0] = 1;
for(int i = 1; i <= n ; i++)
mas[i] = 0;
for(int i = 1; i <= n; i++)
for(int j = i; j >= 1; j--)
mas[j] += mas[j-1];
cout << setw(2) << n << ":";
for(int i = 0; i < 35 - 5 * n / 2; i++)
cout << " ";
for(int i = 0; i <= n ; i++)
cout << setw(5) << mas[i];
cout << endl;
}
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
#include <iostream>
#include <iomanip>
using namespace std;
#define N 15
#define S 128
int main () {
int mas[S];
for(int n = 0; n < N; n++) {
mas[0] = 1;
for(int i = 1; i <= n ; i++)
mas[i] = 0;
for(int i = 1; i <= n; i++)
for(int j = i; j >= 1; j--)
mas[j] += mas[j-1];
cout << setw(2) << n << ":";
for(int i = 0; i < 35 - 5 * n / 2; i++)
cout << " ";
for(int i = 0; i <= n ; i++)
cout << setw(5) << mas[i];
cout << endl;
}
return 0;
}