Output based on Math functions – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2017-03G #JAVA#7244    siteicon   siteicon  

Problem Statement - Output based on Math functions

What are the values stored in variables r1 and r2:
(i) double r1 = Math.abs(Math.min(-2.83, -5.83));
(ii) double r2 = Math.sqrt(Math.floor(16.3));

Solution

TC++ #7244

(i) double r1 = Math.abs(Math.min(-2.83,-5.83));
= Math.abs(-5.83)
= 5.83
(ii) double r2 = Math.sqrt(Math.floor(16.3));
= Math.sqrt(16)
= 4.0

Notes


Share

CSKC| Created: 15-Apr-2019 | Updated: 27-Nov-2019|ICSE2017









Back