-
Notifications
You must be signed in to change notification settings - Fork 0
/
MathOperations.java
44 lines (38 loc) · 1004 Bytes
/
MathOperations.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
public class MathOperations {
public static void main( String[] args ) {
int a, b, c, d, e, f, g;
double x, y, z;
String one, two, both;
a = 10;
b = 27;
System.out.println( "a is " + a + ", b is " + b );
c = a + b;
System.out.println( "a+b is " + c );
d = a - b;
System.out.println( "a-b is " + d );
e = a+b*3;
System.out.println( "a+b*3 is " + e );
f = b / 2;
System.out.println( "b/2 is " + f );
g = b % 10;
System.out.println( "b%10 is " + g );
x = 1.1;
System.out.println( "\nx is " + x );
y = x*x;
System.out.println( "x*x is " + y );
z = b / 2;
System.out.println( " b/2 is " + z );
System.out.println();
one = "dog";
two = "house";
both = one + two;
System.out.println( both );
System.out.println();
int h;
double w;
h = ( a + 5 ) % 12;
System.out.println( "(a+5)%12 is " + h);
w = ( b * 9.7 - 7) / 4;
System.out.println( "(b*9.7-7)/4 is " + w );
}
}