- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA93.java
More file actions
Latest commit
21 lines (21 loc) · 467 Bytes
/
Copy pathA93.java
File metadata and controls
21 lines (21 loc) · 467 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
classA93
{
publicstaticvoidmain(String[] args)
{
inta[] = {2,3,7,10,8,9};
intsumEven=0,sumOdd=0;
System.out.println("---- PROGRAM will PRINT DIFFERENCE BTW SUM OF Odd & EVEN no. from an ARRAY ");
for (inti=0;i<a.length ;i++ )
{
if (a[i]%2 !=0)
{
sumEven = sumEven+a[i];
}
else
{
sumOdd = sumOdd +a[i];
}
}
System.out.println("DIFFERENCE OF SUM OF ODD AND EVEN is "+ (sumOdd-sumEven));
}
}