Math Function

 

Math Function

Mathmetical functions such as sign, sqrt, max etc are frequently used in the analysis of real life problems. The Math class defines several methods that provide arious types of rounding operations.

1)EXAMPLE…..

Class abc

{

public static void main(String hh[])

{

int a=25;

int b;

b=Math.sqrt(a);

System.out.print(“b=”+b);

}

}

2)EXAMPLE…..

Class as

{

public static void main(String hh[])

{

double x;

x=Math.max(10,25);

System.out.println(“maximum=”+x);

x=Math.sqrt(64);

System.out.println(”square root=”+x);

x=Math.abs(-65);

System.out.println(”absolute value=”+x);

x=Math.min(10,25);

System.out.println(“minimum=”+x);

}

}

}

}