KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Predict the output of the following Java program snippet:

System.out.println(Math.max(Math.ceil(14.55),15.5));

Java

Java Math Lib Methods

36 Likes

Answer

15.5

Working

Math.ceil(14.55) gives 15.0 as it is the smallest whole number greater than 14.55. After that Math.Max() becomes Math.max(15.0, 15.5). As 15.5 is greater than 15.0, it is the output.

Answered By

22 Likes