Computer Science, asked by mehtaritesh2310, 4 days ago

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 Anonymous
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