Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1.         static int Negativos(int[,] mat)
  2.         {
  3.  
  4.             int linhas = mat.GetLength(0);
  5.             int colunas = mat.GetLength(1);
  6.  
  7.             int numNegativo = 0;
  8.            
  9.             for (int i = 0 ; i < linhas ; i++)
  10.             {
  11.                 for (int c = 0 ; c < colunas; c++)
  12.                 {
  13.                     if (mat[i,c] < 0)
  14.                     {
  15.                         numNegativo++;
  16.                     }
  17.                 }
  18.             }
  19.             return numNegativo;
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement