public class My_math_function
{
public static void main
(String args[])
{
double m=6.25;
double n=8.75;
System.out.println("The
output of different Mathematical functions are:");
System.out.println("Square root of 6.25=" +Math.sqrt(m));
System.out.println("Minimum value between 6.25 & 8.75="
+Math.min(m,n));
System.out.println("Maximum value between 6.25 &
8.75="+Math.max(m,n));
System.out.println("6.25 raised to the power
3"+Math.pow(m,3));
System.out.println("natural log of 6.25="+Math.log(m));
System.out.println("Absolute value of
(6.25-8.75)="+(float)Math.abs(m-n));
System.out.println("Rounded value of 6.25="+Math.round(m));
System.out.println("The floor value of 6.25 ="+Math.floor(m));
System.out.println("The ceil value of 6.25 ="+Math.ceil(m));
System.out.println("Truncated value of 6.25="+Math.rint(m));
System.out.println("Exponent value of 6.25="+Math.exp(m));
}
}
Expected Output is :
The output of different Mathematical functions are:
Square root of 6.25=2.5
Minimum value between 6.25 & 8.75=6.25
Maximum value between 6.25 & 8.75=8.75
6.25 raised to the power 3244.140625
natural log of 6.25=1.8325814637483102
Absolute value of (6.25-8.75)=2.5
Rounded value of 6.25=6
The floor value of 6.25 =6.0
The ceil value of 6.25 =7.0
Truncated value of 6.25=6.0
Exponent value of 6.25=518.012824668342
This comment has been removed by the author.
ReplyDelete