Tuesday, 14 May 2013

JAVA Maths Functions

class file_name{
       public static void main(String ar[]){
                System.out.println("Max : "+Math.max(10,15));
                System.out.println("Min : "+Math.min(10,15));
                System.out.println("Ceil : "+Math.ceil(10.5));
                System.out.println("Floor : "+Math.floor(10.5));
                System.out.println("Squrt : "+Math.sqrt(49));
                System.out.println("PI : "+Math.E);
                System.out.println("abs : "+Math.abs(-57));
                System.out.println("PI : "+Math.PI);

       }


OutPut
------------------------------------
max : 15
min : 10
ceil : 11.0
floor : 10.00
sqrt : 7.0
pi : 2.718281828459045
abs : 57
PI : 3.141592653589793
 

No comments:

Post a Comment