Friday, October 17, 2014

Mathematical Methods In Java

Program:

package prem3;

public class koresi3 {
public static void main(String[] args){
System.out.println(Math.abs(-3.8)); //absolute value will be the output
System.out.println(Math.pow(3.3, 2));//here 3.3^2=10.88999999999 
System.out.println(Math.max(294, 654));//here the maximum value will be the output
System.out.println(Math.min(856, 121));//here the minimum value is 121
System.out.println(Math.ceil(9.8));//here 9.8 will be 10
System.out.println(Math.ceil(13.4));//here 13.4 will be 14
System.out.println(Math.floor(45.6));//here 45.6 will be 45
System.out.println(Math.sqrt(225));//sqrt means sqare route so output 15
}
}


Output:

3.8
10.889999999999999
654
121
10.0
14.0
45.0
15.0

Screenshots

Program


Output


No comments: