Advertisement
Guest User

https://ehazi.hu/q/117282

a guest
Oct 8th, 2022
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. #define N 5
  5.  
  6. using namespace std;
  7.  
  8. void babra(int a[][N], unsigned n) {
  9.     for(int i = 1; i < n; i++) {
  10.         for(int j = 0; j < i; j++) {
  11.             a[i][j] = a[i-1][j] + 1;
  12.             a[n-1-j][n-1-i] = a[i][j];
  13.         }
  14.     }
  15. }
  16.  
  17. void kiir(int a[][N], unsigned n) {
  18.     for(int i = 0; i < n; i++) {
  19.         for(int j = 0; j < n; j++) {
  20.             cout << setw(2) << a[i][j];
  21.         }
  22.         cout << endl;
  23.     }
  24. }
  25.  
  26. int main() {
  27.     int arr[N][N] = {};
  28.    
  29.     babra(arr, N);
  30.     kiir(arr, N);
  31.    
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement