Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public class contarColumnasConCeros {
  2.  
  3. public int contarColumnas(double[][] matriz) {
  4. int cantidadDeColumnasConCeros = 0;
  5.  
  6. for (int i = 0; i < matriz.length; i++) {
  7.  
  8. int contador = 0;
  9.  
  10. for (int j = 0; j < matriz[i].length; j++) {
  11.  
  12. if (matriz[i][j] == 0) {
  13.  
  14. contador++;
  15.  
  16. }
  17.  
  18.  
  19. }
  20.  
  21. if (contador > 0) {
  22.  
  23. cantidadDeColumnasConCeros++;
  24.  
  25. }
  26.  
  27. }
  28.  
  29. return cantidadDeColumnasConCeros;
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement