Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Different Math Function in Java Program
WhatsApp
Alagunila Meganathan
Aug 03
2016
618
0
0
mathclass.rar
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 argument = "
+ 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
));
}
}
Java
Up Next
Different Math Function in Java Program