uikolas

C++ po šalutinę istrižainę didžiausiais skaičius

Jan 22nd, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. void Didziausias(int A[][50], int n, int & nr){
  2.     int did = 0;
  3.     for(int i = 1; i <= n; i++){
  4.         for(int j = n - i; j <= n; j++){      
  5.                 if (A[i][j] > did){
  6.                     did = A[i][j]; // kuris elementas didziausias po salutine istrizaine
  7.                     nr = i; // kuri eilute
  8.                 }
  9.         }
  10.     }
  11.     cout << did << endl;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment