-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvennessFunction.java
More file actions
64 lines (57 loc) · 1.44 KB
/
Copy pathEvennessFunction.java
File metadata and controls
64 lines (57 loc) · 1.44 KB
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
54
55
56
57
58
59
60
61
62
63
64
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment_10528808;
/**
*
* @author Mawutor
*/
import java.util.Scanner;
public class EvennessFunction
{
public static boolean isEven(int n)
{
if(n%2==0)
{
return true;
}
else
{
return false;
}
}
public static boolean isDivisible(int n)
{
if(n%3==0)
{
return true;
}
else
{
return false;
}
}
public static void main(String[]arg)
{
Scanner input = new Scanner(System.in);
for(int i=1;i<=20;i++)
{
System.out.println(i);
if(isEven(i)==true)
{
System.out.println(i+"<");
}
else if(isDivisible(1)==true)
{
System.out.println(i+"=");
}
else if(isDivisible(i)==true && isEven(i)==true);
{
System.out.println(i+"<=");
}
System.out.println(i);
}
}
}