Advertisement
kolioi

15. Cartesian Product C++

Nov 19th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. int main()
  4. {
  5.     using namespace std;
  6.  
  7.     int lenght, n;
  8.     cin >> lenght;
  9.     vector<int> arr;
  10.     for (int i = 0; i < lenght; ++i)
  11.     {
  12.         cin >> n;
  13.         arr.push_back(n);
  14.     }
  15.  
  16.     for (int i = 0; i < lenght; ++i)
  17.         for (int j = 0; j < lenght; ++j)
  18.             cout << arr[i] * arr[j] << ' ';
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement