/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lab1;

/**
 *
 * @author kmhasan
 */
public class Lab1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("Hello, World!");
        System.out.printf("I am %d years old.\n", 38);
        
        int x = 10;
        /*
        Task 1:
        Declare two integer variables, x and y.
        Put the minimum of those two variables in a third variable z.
        Print the value of z.
        */
        
        /*
        Task 2:
        Solve the same problem using Math.min method. Math.min(x, y) should
        return the minimum value.
        */
        
        /*
        Task 3:
        There are many useful methods in the Math class. You can search for
        "Java Math API" to look at the documentation.
        https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
        Look up the documentation to see how you can compute,
        a) exponentiation
        b) square root
        Calculate and print the value of 2^10 and square root of 450
        Also print the value of x where
        int x = 2 ^ 10;
        */
    }
    
}

@@ -464,28 +464,8 @@
    %0A
-        int x = 10;%0A
     
@@ -638,32 +638,192 @@
 f z.%0A        */%0A
+        int x = 10;%0A        int y = 25;%0A        int z;%0A        if (x %3C y)%0A            z = x;%0A        else z = y;%0A        System.out.printf(%22Minimum: %25d%5Cn%22, z);%0A
         %0A       
@@ -896,16 +896,25 @@
 method. 
+%0A        
 Math.min
@@ -926,24 +926,16 @@
 ) should
-%0A       
  return 
@@ -956,32 +956,107 @@
 lue.%0A        */%0A
+        z = Math.min(x, y);%0A        System.out.printf(%22Minimum: %25d%5Cn%22, z);%0A
         %0A       
@@ -1131,16 +1131,24 @@
 h class.
+%0A       
  You can
@@ -1158,24 +1158,16 @@
 arch for
-%0A       
  %22Java M
@@ -1185,24 +1185,32 @@
  look at the
+%0A       
  documentati
@@ -1440,16 +1440,25 @@
 of 2%5E10 
+%0A        
 and squa
@@ -1475,72 +1475,1023 @@
  450
-%0A        Also print the value of x where%0A        int x = 2 %5E 10;
+. Also, print the value of x where%0A        int x = 2 %5E 10;%0A        */%0A        double power = Math.pow(2, 10);%0A        double squareRoot = Math.sqrt(450);%0A        System.out.printf(%22Power: %258.0f%5Cn%22, power);%0A        System.out.printf(%22Square Root: %25f%5Cn%22, squareRoot);%0A        x = 2 %5E 10; %0A        // 2  = 0010 (in binary)%0A        // 10 = 1010 (in binary)%0A        // ------------- XOR (exclusive OR)%0A        // 8  = 1000%0A        System.out.printf(%22Power: %25d%5Cn%22, x);%0A        %0A        /*%0A        Task 4:%0A        Find the smallest element from an array%0A        */%0A        int data%5B%5D = %7B5, 1, 5, 2, 3, 6, 7, 2%7D;%0A        /*%0A        min = 10000;%0A        i %7C data%5Bi%5D %7C min%0A        ------------------%0A        0 %7C 5       %7C 5%0A        1 %7C 1       %7C 1%0A        2 %7C 5       %7C 1%0A        3 %7C 2       %7C 1%0A        ...%0A        %0A        data.length gives you the number of elements in the%0A        array%0A        %0A        for (int i = 0; i %3C data.length; i++)%0A        ...%0A        %0A        What should we really use for the initial minimum?
 %0A   
@@ -2494,24 +2494,33 @@
 %0A        */%0A
+        %0A
     %7D%0A    %0A%7D

lab task