Advertisement
desislava_topuzakova

паскал1

Mar 11th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int rows, k = 1;
  8.  
  9.     cout << "Enter number of rows: ";
  10.     cin >> rows;
  11.  
  12.     for (int i = 0; i < rows; i++)
  13.     {
  14.         for (int space = 1; space <= rows - i; space++)
  15.             cout << "  ";
  16.  
  17.         for (int j = 0; j <= i; j++)
  18.         {
  19.             if (j == 0 || i == 0)
  20.                 k = 1;
  21.             else
  22.                 k= k*(i - j + 1) / j;
  23.  
  24.             cout << k << "   ";
  25.         }
  26.         cout << endl;
  27.     }
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement