Friday, June 8, 2012

Write a program to check all the math class functions.?


♣♣♣ WRITE A PROGRAM TO CHECK ALL THE MATH CLASS FUNCTIONS. ♣♣♣


import java.io.*;
class pro10
        {
                public static void main(String ar[]) throws IOException
                {
                       InputStreamReader a =new InputStreamReader(System.in);
                       BufferedReader b=new BufferedReader(a);
                       System.out.println("\n\n\t\t  ****** Mathematical Functions ***** \n");
                       System.out.println("\n\t\t-----------------------------------------\n");
                       System.out.println("\n\n\t\t\t<== Exponential Functions ==>\n");
                       System.out.println("\n\t\t\t-----------------------------\n");
                       System.out.println("\n\tExponential Value = "+Math.exp(3));
                       System.out.println("\n\tpower Value = "+Math.pow(2,2));
                       System.out.println("\n\n\t\t\t<== Trignometrical Functions ==>\n");
                       System.out.println("\n\t\t\t--------------------------------\n");
                       System.out.println("\n\t sin Value = "+Math.sin(30));
                       System.out.println("\n\t cos Value = "+Math.cos(30));
                       System.out.println("\n\t tan Value = "+Math.tan(30));
                       System.out.println("\n\t cot Value = "+Math.atan(30));
                       System.out.println("\n\t <== Ordinary Mathematical Functions ==>\n");
                       System.out.println("\n\t\t\t---------------------------------------\n");
                       System.out.println("\n\tAbsolute Value = "+Math.abs(-30));
                       System.out.println("\n\tRound Value = "+Math.abs(10.456));
                       System.out.println("\n\tCeil Value = "+Math.ceil(10.4));
                       System.out.println("\n\tFloor Value = "+Math.floor(10.456));
                       System.out.println("\n\tSquare Root Value = "+Math.sqrt(9));

                }
        }
OUTPUT :-
                        ****** Mathematical Functions *****
                   -------------------------------------------------------
<== Exponential Functions ==>
                        ---------------------------------------
            Exponential Value = 20.085536923187668
            Power Value  = 4.0
                        <== Trignometrical Functions ==>
                        ------------------------------------------
            Sin Value = -0.9880316240928618
            Cos Value = 0.15425144988758405
            Tan Value =  -6.405331196646276
            Cot Value = 1.5374753309166493
                        <== Ordinary Mathematical Functions ==>
                        ----------------------------------------------------
            Absolute Value = 30
Round Value = 10.456
Floor Value    = 10.0
Square Root Value = 3.0

No comments:

Post a Comment