-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.java
68 lines (54 loc) · 1.32 KB
/
Test.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import maths.Multiply;
import maths.Sum;
public class Test {
public static void main(String[] args) {
int age = 21;
String name = "Aman Kumar";
checkValidity(name, age);
checkEvenOdd(16);
checkPrime(17);
checkPositiveNegativeNeutral(-1);
}
static void checkValidity(String name, int age)
{
if(age > 17)
{
System.out.println(name+" is valid candidate");
}
else{
System.out.println(name+" is not a valid candidate");
}
}
static void checkEvenOdd(int n)
{
if(n%2==0)
System.out.println(n+" is Even");
else
System.out.println(n+ " is odd");
}
static void checkPrime(int n)
{
int count = 0;
for(int i=1;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==2)
{
System.out.println(n+" is a prime number");
}
else
{
System.out.println(n+" is not a prime number");
}
}
static void checkPositiveNegativeNeutral(int n)
{
if(n>0) System.out.println(n+" is positive");
else if(n<0) System.out.println(n+" is negative");
else System.out.println(n+" is neutral");
}
}