Ask Question

Which of the following would compile without error? A. int a = Math. abs (-5); B. int b = Math. abs (5.0); C. int c = Math. abs (5.5F); D. int d = Math. abs (5L);

+4
Answers (1)
  1. 23 September, 09:39
    0
    int a = Math. abs (-5)

    Explanation:

    Math. abs () is the function which gives the absolute value of the integer.

    syntax:

    Math. abs (int name);

    the argument enter must be integer (int).

    int b = Math. abs (5.0) : here, 5.0 is not the integer, it is float. So, it gives error.

    int c = Math. abs (5.5F) : here, 5.5F is not the integer, it is float. So, it gives error.

    int d = Math. abs (5L) : L stand for long but it is not int. So, it also gives error.

    Therefore, the correct result is int a = Math. abs (-5), - 5 is integer.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following would compile without error? A. int a = Math. abs (-5); B. int b = Math. abs (5.0); C. int c = Math. abs (5.5F); D. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers