Trouver la valeur maximale d’un tableau à deux dimensions

Author:


Download

#include 
#include

static double maximum( double matrice[][] )
{
  double max = matrice[0][0];
  int nligne=matrice.length;
  for ( int r = 0; r < nligne; ++r )
    for ( int c = 0; c < matrice[r].length; ++c )
      if ( max < matrice[r][c] )
        max = matrice[r][c];
  return max;
}
int main()
{
   		double matrice[][]={
   							{12.5, 0.5, 3.0},
   							{-42.5, 15, 10.0, 85},
   							{20, 3, 3.0, 6.0}
   			               };
  printf ("Valeur Maximale du tableau 2D= %d ", maximum(matrice));
}

Leave a Reply

Your email address will not be published. Required fields are marked *