Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MaiorColuna {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int[][] matriz = new int[5][3];
- for (int i = 0; i < 5; i++) {
- for(int j = 0; j < 3; j++) {
- matriz[i][j] = in.nextInt();
- }
- }
- int maior;
- for (int i = 0; i < 3; i++) {
- maior = -100000;
- for(int j = 0; j < 5; j++) {
- if (matriz[j][i] > maior) {
- maior = matriz[j][i];
- }
- }
- System.out.printf("Maior da coluna %d é: %d\n", i+1, maior);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement