8 views

Uploaded by Ravi Prakash Verma

- May- 6106- VII Sem Software Engg
- May-7473- VII SEm Software Engg
- Nov- 1406- VII Sem Software Engg
- Doc Data Quality
- Structured Representations
- GettingStarted_With Data Quality Guide
- GettingStarted_With Data Quality Guide
- cycle-I
- Apache
- Spark Week 1 Lecture
- 2VxworksTraining
- PC 910 TransformationGuide En
- In for Matic a Data Quality 9
- DQ 951 InstallationAndConfigurationGuide En
- FMS Admission Brochure 2012
- java pgm9
- Java Pgm20
- Java Pgm10
- Java Pgm14
- Java Pgm17

You are on page 1of 3

14

Date:

Mathematical Functions

Aim:

To write a java program to perform mathematical operations.

Source Code:

import java.io.*;

public class mathclass{

public static void main(String[] args){

//E and round()

Double a = Math.E;

System.out.println("e = " + Math.round(a*100)/100f);

//PI

System.out.println("pi = " + Math.round(Math.PI*100)/100f);

//abs()

System.out.println("Absolute number = " + Math.abs(Math.PI));

//ceil()

System.out.println("Smallest integer value but greater than the

argument = " + Math.ceil(Math.PI));

//exp()

System.out.println("Exponent number powered by the argument = "

+ Math.exp(0));

//floor()

System.out.println("Largest integer value but less than the argu

ment = " + Math.floor(Math.E));

//IEEEremainder()

System.out.println("Remainder = " + Math.IEEEremainder(5.3f,2.2f

));

//max()

System.out.println("Maximum Number = " + Math.max(10,10.3));

//min()

System.out.println("Minimum Number = " + Math.min(10,10.3));

//pow()

System.out.println("Power = " + Math.pow(10,3));

//random()

System.out.println("Random Number = " + Math.random());

//rint()

System.out.println("Closest to the Argument = " + Math.rint(30))

;

//round()

System.out.println("Round = " + Math.round(Math.E));

//sqrt()

System.out.println("Square Root = " + Math.sqrt(400));

}

}

Output:

Javac mathclass.java

Java mathclass

e = 2.72

pi = 3.14

Absolute number = 3.141592653589793

Smallest integer value but greater than the argument = 4.0

Exponent number powered by the argument = 1.0

Largest integer value but less than the argument = 2.0

Remainder = 0.9000000953674316

Maximum Number = 10.3

Minimum Number = 10.0

Power = 1000.0

Random Number = 0.4821444718827098

Closest to the Argument = 30.0

Round = 3

Square Root = 20.0

Result:

Thus a java program has been written to perform the mathematical operati

ons.

- May- 6106- VII Sem Software EnggUploaded byRavi Prakash Verma
- May-7473- VII SEm Software EnggUploaded byRavi Prakash Verma
- Nov- 1406- VII Sem Software EnggUploaded byRavi Prakash Verma
- Doc Data QualityUploaded byRavi Prakash Verma
- Structured RepresentationsUploaded byRavi Prakash Verma
- GettingStarted_With Data Quality GuideUploaded byManimala Vidyasagar
- GettingStarted_With Data Quality GuideUploaded byManimala Vidyasagar
- cycle-IUploaded byRavi Prakash Verma
- ApacheUploaded byRavi Prakash Verma
- Spark Week 1 LectureUploaded byRocksta927
- 2VxworksTrainingUploaded byRavi Prakash Verma
- PC 910 TransformationGuide EnUploaded byGyara Prashanth Kumar
- In for Matic a Data Quality 9Uploaded bysasikannadev
- DQ 951 InstallationAndConfigurationGuide EnUploaded byychacha
- FMS Admission Brochure 2012Uploaded bySonam Pandita
- java pgm9Uploaded byRavi Prakash Verma
- Java Pgm20Uploaded byRavi Prakash Verma
- Java Pgm10Uploaded byRavi Prakash Verma
- Java Pgm14Uploaded byRavi Prakash Verma
- Java Pgm17Uploaded byRavi Prakash Verma
- Java Pgm16Uploaded byRavi Prakash Verma
- Java Pgm16Uploaded byRavi Prakash Verma
- Java Pgm16Uploaded byRavi Prakash Verma
- Java Pgm19Uploaded byRavi Prakash Verma
- Java Pgm11Uploaded byRavi Prakash Verma
- Java Pgm13Uploaded byRavi Prakash Verma
- Java Pgm18Uploaded byRavi Prakash Verma
- Java Pgm15Uploaded byRavi Prakash Verma
- Java Pgm15Uploaded byRavi Prakash Verma
- Java Pgm12Uploaded byRavi Prakash Verma