Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double array[5][3];
- double rowSum[5] = {0, 0, 0, 0, 0};
- double minRow = 100;
- double maxRow = 0;
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 3; ++j) {
- cout << "Enter number for position " << i << " | " << j << " = ";
- cin >> array[i][j];
- }
- }
- cout << endl;
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 3; ++j) {
- cout << array[i][j] << " | ";
- }
- cout << endl;
- }
- for (int i = 0; i < 5; ++i) {
- for (int j = 0; j < 3; ++j) {
- rowSum[i] = rowSum[i] + array[i][j];
- }
- }
- for (int i = 0; i < 5; ++i) {
- if (maxRow < rowSum[i]){
- maxRow = rowSum[i];
- }
- }
- for (int k = 0; k < 5; ++k) {
- if (rowSum[k] < minRow)
- {
- minRow = rowSum[k];
- }
- }
- cout << endl << "Min: " << minRow << " max: " << maxRow << endl << endl;
- for (int i = 0; i < 5; i++){
- cout << "The sum of row " << i + 1 << " is " << rowSum[i] << endl;
- }
- cin >> array[1][2];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement