Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,m,i,j,min,max;
  8.     cout <<"Vnesi go m:"<<endl;
  9.     cin>>m;
  10.     cout <<"Vnesi go n:"<<endl;
  11.     cin>>n;
  12.     int mat[m][n];
  13.     int pom[m];
  14.      cout <<"Vnesi gi clenovite na matricata:"<<endl;
  15.     for(i=0;i<m;i++)
  16.     {
  17.         for(j=0;j<n;j++)
  18.         {
  19.            cin>>mat[i][j];
  20.         }
  21.     }
  22.     for(i=0;i<m;i++)
  23.     {
  24.         for(j=0;j<n;j++)
  25.         {
  26.            cout<<mat[i][j]<<" ";
  27.         }
  28.         cout<<endl;
  29.     }
  30.     for(i=0;i<m;i++)
  31.  
  32.     {
  33.         max=mat[i][0];
  34.         for(j=0;j<n;j++)
  35.         {
  36.            if(mat[i][j]>max)
  37.  
  38.            max=mat[i][j];
  39.  
  40.         }
  41.         pom[i]=max;
  42.  
  43.     }
  44.     min=pom[0];
  45.     for(j=0;j<n;j++)
  46.     {
  47.         if(pom[j]<min)
  48.             min=pom[j];
  49.     }
  50.     cout<<"Najmaliot od najgolemite po redici e: "<<min<<endl;
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement