Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, a[20][20];
  4. void Rez()
  5. {
  6. for(int i = 1; i <= n; i++)
  7. a[i][1] = i,
  8. a[n][i] = n;
  9.  
  10. for(int j = 2; j <= n; j++)
  11. for(int i = 1; i < n; i++)
  12. a[i][j] = a[i][j - 1] + a[i + 1][j - 1];
  13.  
  14. for(int i = 1; i <= n; i++)
  15. {
  16. for(int j = 1; j <= n; j++) cout << a[i][j] << " ";
  17. cout << "\n";
  18. }
  19.  
  20. }
  21. int main()
  22. {
  23. cin >> n;
  24. Rez();
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement