///
import javax.swing.JOptionPane; public class A001 { public static void main(String[] args) { int[][] v = {{1, 10, 8}, {15, 40, 16}, {10, 33, 91}, {0, 44, 51}}; int d=Integer.parseInt(JOptionPane.showInputDialog("Digite um valor")); System.out.print(f(v, 3, 2, d)); } public static boolean f(int[][] valores, int n, int m, int x) { int i, j, cont, p, q; boolean a; a = false; i = 0; while (i <= n && !a) { j = 0; while (j <= m && !a) { if (valores[i][j] == x) { a = true; } j = j + 1; } i = i + 1; } return a; } }
Considere que o programa foi executado quatro vezes seguidas sendo fornecidos, consecutivamente, os valores 10, 41, 0 e -2 para a variável d. Neste contexto, pode-se concluir corretamente que serão exibidos como resultado destas execuções, consecutivamente, os valores