forked from ab-rohman/Open-Hack2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeterminingTheSmallestLargestValue.java
62 lines (55 loc) · 2 KB
/
DeterminingTheSmallestLargestValue.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Hacktober;
/**
*
* @author Judha Maygustya
*/
import java.util.Scanner;
public class DeterminingTheSmallestLargestValue {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int container [][] = new int[3][5];
System.out.println(" ====== INPUT MATRIKS VALUE======\n");
for (int i = 0; i < container.length; i++) {
for (int j = 0; j < container[0].length; j++) {
System.out.print("Input Numbers to [" + i + "] [" + j + "] :");
container[i][j] = input.nextInt();
}
}
System.out.println("\n ======= MATRIKS VIEW=======");
for (int i = 0; i < container.length; i++) {
for (int j = 0; j < container[0].length; j++) {
System.out.println("[" + i + "] [" + j + "] : " + container[i][j]);
}
}
System.out.println(" ");
System.out.println(" ");
//Baris Terbesar //
for (int i = 0; i < container.length; i++) {
int terbesar = 0;
for (int j = 0; j < container[0].length; j++) {
if (container[i][j] > terbesar) {
terbesar = container[i][j];
}
}
System.out.println("Largest Number In Row [" + i + "] = " + terbesar);
}
System.out.println(" ");
System.out.println(" ");
//Kolom Terbesar //
for (int i = 0; i < container[0].length; i++) {
int terbesar = 0;
for (int j = 0; j < container.length; j++) {
if (container[j][i] > terbesar) {
terbesar = container[j][i];
}
}
System.out.println("Largest Number In Column [" + i + "] = " + terbesar);
}
}
}
// Code BY Judha Maygustya