source file name:   mathdemo1.java

class mathdemo1

{

public static void main(String as[])

{

System.out.println("square root value:"+Math.sqrt(36));

System.out.println("power value:"+Math.pow(5,4));

System.out.println("maximum between 2 numbers:"+Math.max(100,50));

System.out.println("minimum between 2 numbers:"+Math.min(100,50));

System.out.println("sin(60)"+Math.sin(60));

System.out.println("cos(0)"+Math.cos(0));

System.out.println("tan(0)"+Math.tan(45));


System.out.println("rounding up"+Math.ceil(55.15));

System.out.println("rounding up"+Math.ceil(55.51));

System.out.println("rounding down:"+Math.floor(55.15));

System.out.println("rounding down:"+Math.floor(55.51));

System.out.println("rounding truncated:"+Math.rint(55.15));

System.out.println("rounding truncated:"+Math.rint(55.51));

}

}

output:


D:\JavaPrograms\Misc>javac mathdemo1.java


D:\JavaPrograms\Misc>java mathdemo1

square root value:6.0

power value:625.0

maximum between 2 numbers:100

minimum between 2 numbers:50

sin(60)-0.3048106211022167

cos(0)1.0

tan(0)1.6197751905438615

rounding up56.0

rounding up56.0

rounding down:55.0

rounding down:55.0

rounding truncated:55.0

rounding truncated:56.0