-
Notifications
You must be signed in to change notification settings - Fork 0
/
YT02.java
49 lines (43 loc) · 1.11 KB
/
YT02.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
import java.io.*;
public class YT02
{
public static void main(String args[])throws IOException
{
int a[][] = new int[3][3];
int sum_even=0;
int sum_odd=0;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the 3x3 matrix: ");
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
a[i][j]=Integer.parseInt(br.readLine());
}
}
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
if(a[i][j]%2==0)
{
sum_even=sum_even+a[i][j];
}
else
{
sum_odd=sum_odd+a[i][j];
}
}
}
System.out.println("Result: ");
if(sum_even==sum_odd)
{
System.out.println("Special Array");
}
else
{
System.out.println("NOT");
}
}
}