Advertisement
Mancolo

Untitled

Feb 3rd, 2021
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         //1
  7.         int first = (101 + 0) / 3;
  8.         double second = 3.0e-6 * 10000000.1;
  9.         boolean third = true && true;
  10.         boolean fourth = false && true;
  11.         boolean fifth = (false && false) || (true && true);
  12.         boolean sixth = (false || false) && (true && true);
  13.         System.out.println("(101+0)/3 ->" + first);
  14.         System.out.println("(3.0e-6 * 10000000.1) ->" + second);
  15.         System.out.println("(true && true) ->" + third);
  16.         System.out.println("(false && true)->" + fourth);
  17.         System.out.println("((false && false) || (true && true))->" + fifth);
  18.         System.out.println("(false || false) && (true && true)->" + sixth);
  19.         //2
  20.         int a = -5 + 8*6;
  21.         int b = (55+9) % 9;
  22.         int c = 20 + -3*5/8;
  23.         int d = 5 +15/3*2-8%3;
  24.         System.out.println(a);
  25.         System.out.println(b);
  26.         System.out.println(c);
  27.         System.out.println(d);
  28. //3
  29.         System.out.println(4.0 * (1 - (1.0f / 3) + (1.0f / 5) - (1.0f / 7) + (1.0f / 9) - (1.0f / 11)));
  30.  
  31. //4
  32.         double a1 = 0;
  33.         int[] b1 = {12, 5, 7, 10, 15};
  34.         for(float i : b1) {
  35.             a1 = a1 + i / b1.length;
  36.         }
  37.         System.out.println(a1);
  38.  
  39.  
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement