Write a program in java to round off a number 9.49 by using Math.round() and Math.rint() and also give its output..
Answers
Answered by
1
Answer:
Program:
class MathFunctions
{
public static void main(String[] args)
{
double number = 9.49;
// Apply the 2 Math functions and store it in 2 variables 'a'
// and 'b'
double a = Math.round(number);
int b = Math.rint(number);
//Display
System.out.println(a);
System.out.println(b);
}
}
Output:
10.0
10
Similar questions
Math,
2 days ago
Social Sciences,
2 days ago
Science,
4 days ago
Math,
4 days ago
Computer Science,
8 months ago
English,
8 months ago
Science,
8 months ago