-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathifElseOddEven.java
More file actions
49 lines (37 loc) · 922 Bytes
/
ifElseOddEven.java
File metadata and controls
49 lines (37 loc) · 922 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
public class ifElseOddEven{
public static void main(String [] aaa){
Scanner n=new Scanner(System.in);
System.out.println("enter 4 numbers :");
int odd=0;
int even=0;
int a=n.nextInt();
int b=n.nextInt();
int c=n.nextInt();
int d=n.nextInt();
if (a%2==0){
System.out.println(a+" is even number");
even++;}
else {
System.out.println(a+" is odd number");
odd++;}
if (b%2==0){
System.out.println(b+" is even number");
even++;}
else {System.out.println(b+" is odd number");
odd++;}
if (c%2==0){
System.out.println(c+" is even number");
even++;}
else {
System.out.println(c+" is odd number");
odd++;}
if (d%2==0){
System.out.println(d+" is even number");
even++;}
else {
System.out.println(d+" is odd number");
odd++;}
System.out.println("we have " +odd+" odd numbers and "+even+" even numbers");
}
}