मराठी

What will be the output of the given Java code after the calculation [note the data types]? double gm = Math.round (Math.min (Math.pow (2.3, 2), Math.sqrt(62.5))); System.out.println ("GM=" +gm);

Advertisements
Advertisements

प्रश्न

What will be the output of the given Java code after the calculation [note the data types]?

double gm = Math.round (Math.min (Math.pow (2.3, 2), Math.sqrt(62.5)));

System.out.println ("GM=" +gm);

बेरीज
Advertisements

उत्तर

Math.pow(2.3, 2):

2.3² = 5.29

Math.sqrt(62.5):

√62.5 ≈ 7.905694

Math.min(5.29, 7.905694):

= 5.29

Math.round(5.29):

= 5 (returns a long)

The value 5 is assigned to the double variable gm:

GM = 5.0

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1: Revision of Class 9 Syllabus - Exercises [पृष्ठ ४६]

APPEARS IN

रूपा पंडित Computer Applications [English] Class 10 ICSE
पाठ 1 Revision of Class 9 Syllabus
Exercises | Q 5. (viii) | पृष्ठ ४६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×