-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOddEvenSumAndMuliply.java
53 lines (32 loc) · 1.1 KB
/
OddEvenSumAndMuliply.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
/* Read input from STDIN. Print your output to STDOUT*/
import java.util.*;
import java.io.*;
public class OddEvenSumAndMuliply {
public static void evenOddFinding(int array[]){
int mEvenSum=0;
int mOddSum=0;
for(int i=0;i<array.length;i++){
if(array[i]%2==0){
mEvenSum=mEvenSum+array[i];
}
if(array[i]%2!=0){
mOddSum=mOddSum+array[i];
}
}
System.out.println("EVEN sum: "+ mEvenSum);
System.out.println("Odd sum: "+ mOddSum);
System.out.println("Multi : " +mEvenSum*mOddSum);
}
public static void main(String args[] ) throws Exception {
//Write code here
Scanner sc=new Scanner(System.in);
System.out.print("Enter size: ");
int mArraySize=sc.nextInt();
int[] array=new int[mArraySize];
System.out.print("Value :");
for(int i=0;i<array.length;i++){
array[i]=sc.nextInt();
}
evenOddFinding(array);
}
}