Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- public class ArithExpressions
- {
- public static void main(String[] args)
- {
- int a = 1, b = 3, i = 4, j = 9, k = 6, x = 2, y = 3, r = 2, n = 7, m = -12, rad = 10;
- double res, area, areaRound;
- res = (x+y)/2;
- System.out.println("(x+y)/2= "+res);
- res = Math.pow((1+r)/100.0, n);
- //this takes two arguments the base then the exponent,
- //the base is first input then exp is second
- System.out.println("(1+r)/100^7)=" + res);
- res = Math.sqrt(a*a+b*b);
- System.out.println("math.sqrt(a*a+b*b)="+res);
- area = Math.pow(rad,2)*Math.PI;
- System.out.println("Math.pow(rad,2)*Math.PI"+area);
- areaRound = Math.round(area);
- System.out.println(area);
- area = Math.ceil(area);
- // ceil rounds up
- area = Math.floor(area);
- // floor rounds down
- System.out.println(Math.abs(-12));
- //abs finds absolute value, turns all num to pos
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement