-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoddEven.java
More file actions
27 lines (23 loc) · 740 Bytes
/
oddEven.java
File metadata and controls
27 lines (23 loc) · 740 Bytes
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
import java.util.Scanner;
public class oddEven {
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
int num[] = new int[6];
int sum = 0;
for (int i = 1; i < num.length; i++) {
System.out.println("Enter number " + i + ": ");
num[i] = s.nextInt();
}
for (int i = 1; i < num.length; i++) {
sum = sum + num[i];
}
System.out.println("The total of all number is :"+ sum);
for (int i = 1; i < 2; i++) {
if (sum == 0) {
System.out.println("Even: " + sum);
}else{
System.out.println("Odd :" + sum);
}
}
}
}