#
Java Program – Use of Mathematical Functions

// Mathematical functions
// Mukesh Tekwani
import java.lang.Math;
class Mathematical //driver class
{
public static void main(String args[]) // psvm --- driver method
{
int num1;
double d;
num1 = 2;
d = Math.sqrt(num1);
System.out.println("Square root: " + d);
//power
System.out.println("Power: " + Math.pow(num1, 3));
//max and min
System.out.println("Max value: " + Math.max(23, 17));
System.out.println("Min value: " + Math.min(23, 17));
System.out.println(Math.floor(23.89));
System.out.println(Math.ceil(23.89)); // in base e
System.out.println(Math.log(2)/2.303); //in base 10
}
}

### Share this with your friends:

### Like this:

Like Loading...

## Recent Comments