Advertisement
sheredega

Task #6

Dec 10th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. using namespace std;
  4.  
  5. int main() {
  6.     srand(time(NULL));
  7.     int arr[5][5];
  8.     int min, max;
  9.     cout << "Enter min value of random range: ";
  10.     cin >> min;
  11.     cout << "Enter max value of random range: ";
  12.     cin >> max;
  13.     cout << "Our matrix:\n";
  14.     for (int i = 0; i < 5; i++) {
  15.         for (int j = 0; j < 5; j++) {
  16.             arr[i][j] = min + rand() % (max - min + 1);
  17.             cout << arr[i][j] << " ";
  18.         }
  19.         cout << endl;
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement