Advertisement
rotti321

T4 2021 SIII ex 2

May 19th, 2021
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  int n,m,a[101][101],val;
  6.  cin>>n>>m;
  7.  for(int i=1;i<=n;i++){
  8.      for(int j=1;j<=m;j++){
  9.          cin>>a[i][j];
  10.      }
  11.  }
  12.  for(int i=1;i<=n;i++){
  13.      val=-1;
  14.      for(int j=1;j<=m;j++){
  15.          if(a[i][j]<21 && a[i][j]>val){
  16.              val=a[i][j];
  17.          }
  18.      }
  19.      if(val!=-1){
  20.          cout<<val<<endl;
  21.      }
  22.      else{
  23.          cout<<"Nu exista\n";
  24.      }
  25.  }
  26.  return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement