Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int const m = 5;
- int const n = 5;
- int a[m][n];
- int sum = 0;
- int i, j;
- srand(time(0));
- for (i = 0; i < m; i++) {
- for (j = 0; j < n; j++) {
- a[i][j] = 20 + rand() % 100;
- cout << a[i][j] << "\t";
- }
- cout << endl;
- }
- for (j = 0; j < n; j++) {
- sum = sum + a[1][j] * a[1][j];
- }
- cout << "\n";
- cout << "Sum of the squares of the elements of the second row of the array: " << sum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement