Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- const int n = 6; // ширина матрицы
- const int m = 6; // высота матрицы
- int main()
- {
- int matrix[n][m];
- setlocale( LC_ALL, "Russian" );
- cout << "Матрица " << n << "x" << m << ":" << endl;
- for( int i = 0; i < n; i++ )
- {
- for( int j = 0; j < m; j++ )
- {
- if( i == 0 || j == 0 )
- matrix[i][j] = 1;
- else
- matrix[i][j] = matrix[i - 1][j] + matrix[i][j - 1];
- cout << setw( 4 ) << matrix[i][j] << " ";
- }
- cout << endl;
- }
- system( "pause" );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement