Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- public static void main(String[] args) {
- //1
- int first = (101 + 0) / 3;
- double second = 3.0e-6 * 10000000.1;
- boolean third = true && true;
- boolean fourth = false && true;
- boolean fifth = (false && false) || (true && true);
- boolean sixth = (false || false) && (true && true);
- System.out.println("(101+0)/3 ->" + first);
- System.out.println("(3.0e-6 * 10000000.1) ->" + second);
- System.out.println("(true && true) ->" + third);
- System.out.println("(false && true)->" + fourth);
- System.out.println("((false && false) || (true && true))->" + fifth);
- System.out.println("(false || false) && (true && true)->" + sixth);
- //2
- int a = -5 + 8*6;
- int b = (55+9) % 9;
- int c = 20 + -3*5/8;
- int d = 5 +15/3*2-8%3;
- System.out.println(a);
- System.out.println(b);
- System.out.println(c);
- System.out.println(d);
- //3
- System.out.println(4.0 * (1 - (1.0f / 3) + (1.0f / 5) - (1.0f / 7) + (1.0f / 9) - (1.0f / 11)));
- //4
- double a1 = 0;
- int[] b1 = {12, 5, 7, 10, 15};
- for(float i : b1) {
- a1 = a1 + i / b1.length;
- }
- System.out.println(a1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement