-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsamplemath.java
More file actions
70 lines (53 loc) · 2.29 KB
/
samplemath.java
File metadata and controls
70 lines (53 loc) · 2.29 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
65
66
67
68
69
70
class samplemath {
public static void main(String args[]) {
int sum = math.add(1, 2, 3);
float fsum = math.add(1.0f, 2.0f, 3.0f);
double dsum = math.add(1.0, 2.0, 3.0);
int difference = math.sub(10, 3);
float fdifference = math.sub(10.0f, 3.0f);
double ddifference = math.sub(10.0, 3.0);
int multiplication = math.multi(10, 10);
float fmultiplication = math.multi(10.0f, 10.0f);
double dmultiplication = math.multi(10.0, 10.0);
int division = math.div(10, 10);
float fdivision = math.div(10.0f, 10.0f);
double ddivision = math.div(10.0, 10.0);
boolean iseven = math.isEven(4);
boolean isodd = math.isOdd(5);
boolean ipass = math.isPass(60, 28);
boolean fpass = math.isPass(60f, 28f);
boolean dpass = math.isPass(60.0, 28.0);
boolean ifail = math.isFail(24, 28);
boolean ffail = math.isFail(60f, 28f);
boolean dfail = math.isFail(60.0, 28.0);
io.print("Sum: " + sum + "\n");
io.print("Float Sum: " + fsum + "\n");
io.print("Double Sum: " + dsum + "\n");
io.print("Difference: " + difference + "\n");
io.print("Float Difference: " + fdifference + "\n");
io.print("Double Difference: " + ddifference + "\n");
io.print("Multiplication: " + multiplication + "\n");
io.print("Double Multiplication: " + dmultiplication + "\n");
io.print("Float Multiplication: " + fmultiplication + "\n");
io.print("Division: " + division + "\n");
io.print("Float Division: " + fdivision + "\n");
io.print("Division: " + ddivision + "\n");
io.print("Is Even: " + iseven + "\n");
io.print("Is Odd: " + isodd + "\n");
if (ipass) {
io.print("You are passed, congrats\n");
}
else{
io.print("You are not passed, " + math.sub(60, 5) + " marks for to win the exam.\n");
}
if (ifail) {
io.print("You are not passed, " + math.sub(28, 24) + " marks for to win the exam.\n");
}
else{
io.print("You are passed, congrats\n");
}
int num = 5;
long result = math.factorial(num);
io.print(result);
}
}