Different Math Class Methods coderinme

Different Math Class Methods coderinme

Write Java program to show uses of all Math class methods.
Program:

import java.io.*;
public class Q9 
{
public static void main(String[] args) throws IOException 
{
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the value a for all math class: ");
double a=Double.parseDouble(inp.readLine());
System.out.print("Enter the value of b for max, min, pow: ");
double b=Double.parseDouble(inp.readLine());
System.out.println(" The value of exponential :"+Math.exp(a));
System.out.println(" The value of pie :"+Math.PI);
System.out.println(" The absolute value of " + a + ":"+Math.abs(a));
System.out.println(" The value of basev :"+Math.E);
System.out.println(" The value of cosine :"+Math.cos(a));
System.out.println(" The value of logrithm :"+Math.log(a));
System.out.println(" The value of maximum :"+Math.max(a,b));
System.out.println(" The value of minimum :"+Math.min(a,b));
System.out.println(" The value of power :"+Math.pow(a,b));
System.out.println(" The value of random :"+Math.random());
System.out.println(" The value of round :"+Math.round(a));
System.out.println(" The value of sin :"+Math.sin(a));
System.out.println(" The value of tan :"+Math.tan(a));
System.out.println(" The value of sqrt :"+Math.sqrt(a));
}
}

For more programs on Java, visit our Java Archives

Different Math Class Methods

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.