What's new

Java Math class baka may nakakaalam po

Kaakak

Eternal Poster
Joined
Apr 22, 2019
Posts
293
Reaction
41
Points
259
Baka may nakakaalam po mga boss salamat sa tutulong
Java.PNG
 

Attachments

class name - Math_Operation
fileName - Math_Operation.java


Java:
import java.lang.Math;

class Math_Operation
{
    public static void main(String[] args)
    {
        // floor() returns he largest (closest to positive infinity)
        // double value that is less than or equal to the argument and
        // is equal to a mathematical integer
        System.out.println("Math.floor(10) = "+Math.floor(10));
        System.out.println("Math.floor(7) = "+Math.floor(7));

        //ceil() Returns the smallest (closest to negative infinity)
        // double value that is greater than or equal to the argument
        // and is equal to a mathematical integer
        System.out.println("Math.ceil(6.251) = "+Math.ceil(6.251));

        //min() Returns the smaller of two int values
        System.out.println("Math.min(17,41) = "+Math.min(17, 41));

        //pow() Returns the value of the first argument raised to the power of the second argument
        System.out.println("Math.pow(6,2) = "+Math.pow(6, 2));

        //abs() Returns the absolute value of an int value
        System.out.println("Math.abs(-53) = "+Math.abs(-53));

        //round() Returns the closest long to the argument
        System.out.println("Math.round(21.47) = "+Math.round(21.47));
    }
}

Code:
1642482385987.png


Output:
1642482410642.png
 

Attachments

class name - Math_Operation
fileName - Math_Operation.java


Java:
import java.lang.Math;

class Math_Operation
{
    public static void main(String[] args)
    {
        // floor() returns he largest (closest to positive infinity)
        // double value that is less than or equal to the argument and
        // is equal to a mathematical integer
        System.out.println("Math.floor(10) = "+Math.floor(10));
        System.out.println("Math.floor(7) = "+Math.floor(7));

        //ceil() Returns the smallest (closest to negative infinity)
        // double value that is greater than or equal to the argument
        // and is equal to a mathematical integer
        System.out.println("Math.ceil(6.251) = "+Math.ceil(6.251));

        //min() Returns the smaller of two int values
        System.out.println("Math.min(17,41) = "+Math.min(17, 41));

        //pow() Returns the value of the first argument raised to the power of the second argument
        System.out.println("Math.pow(6,2) = "+Math.pow(6, 2));

        //abs() Returns the absolute value of an int value
        System.out.println("Math.abs(-53) = "+Math.abs(-53));

        //round() Returns the closest long to the argument
        System.out.println("Math.round(21.47) = "+Math.round(21.47));
    }
}

Code:
View attachment 1789905

Output:
View attachment 1789906
maraming salamat lods
 
Back
Top