Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* A PROGRAM TO FIND THE MAXIMUM IN EACH COLOUMN OF A MATRICE AND FIND THE MINIMUM OF THOSE MAXIMUMS */
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "A PROGRAM TO FIND THE MAXIMUM IN EACH COLOUMN OF A MATRICE AND FIND THE MINIMUM OF THOSE MAXIMUMS" << "\n";
- int arr[3][3] = {{1,2,3} , {2,9,4} , {5,6,7}};
- int arr1[3];
- int max = arr[0][0];
- int i , j ;
- cout << "the array is : " << "\n" ;
- for (i=0 ; i < 3 ; i++ )
- {
- for (j=0 ; j < 3 ; j++)
- {
- if (arr[j][i] > max )
- {
- max = arr[j][i];
- }
- }
- arr1[i] = max;
- max = arr[0][i];
- }
- for (i=0 ; i<3 ; i++)
- {
- for (j=0 ; j<3 ; j++)
- {
- cout << arr[i][j] << " ";
- }
- cout << "\n" ;
- }
- cout << "\n" ;
- cout << "the maximum numbers of the coloumns are : " ;
- for (i=0 ; i<3 ; i++)
- {
- cout << arr1[i] << " ";
- }
- int min = arr1[0];
- for (i=0 ; i<3 ; i++)
- {
- if (arr1[i] < min )
- {
- min = arr1[i];
- }
- }
- cout << "\n" ;
- cout << "the minimum of all the elements is : " << min ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement