alarm
Ask a question for free
Computer Science
Egor

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: 1
Register to add an answer
Answer:

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

209
ErikFalk
For answers need to register.
Contacts
mail@expertinstudy.com
Feedback
Expert in study
About us
For new users
For new experts
Terms and Conditions