top of page
ICSE Class 9 Computer Applications
6. Mathematical Library Methods
 
       01  Math class 
                                                 
                  Functions of Math class defined in java.lang package

               

​

 02   Functions of Math class

​

                 pow (x,y) -  returns x raised to y
             sqrt (x) -     returns squareroot of x
             cbrt (x) -     returns cuberoot of x
             ceil(x) -       returns returns smallest whole number greater than or equal to x (Rounded up)
             floor(x) -     returns returns largest whole number less than or equal to x (Rounded down)
             round(x) -   returns integer rounded to the nearest whole number
             abs(x) -      returns absolute value of x
             max(a,b) -  returns maximum of a and b
             min(a,b) -   returns minimum of a and b
             random( ) - generates and returns a random number greater than or equal to 0.0 and less than 1.0

​

 

03   java expressions

​

​                 Write equivalent Java expressions for the following:

                 1. √a+b

              Answer Math.sqrt(a+b)

​

              2. |x²+2xy|

              Answer Math.abs(Math.pow(x, 2)+2*x*y));

​

              3. √(3x + x²) / (a + b)

              Answer Math.sqrt(3 * x + Math.pow(x, 2)) / (a + b)

         

​

                 

​​

Anchor 3
Anchor 2
Anchor 1
bottom of page