English

Evaluate the following expression as per Java priority and associativity. 6598 / (20 % 8)

Advertisements
Advertisements

Question

Evaluate the following expression as per Java priority & associativity.

6598 / (20 % 8)

Evaluate
Advertisements

Solution

Priority (Precedence): Parentheses () have the highest precedence, so the expression inside them evaluates first.

  • (20 % 8): Leaves a remainder of 4 (since 8 × 2 = 16). The expression simplifies to 6598/4.
  • 6598/4: Performs integer division. Since both operands are integers, Java truncates the decimal portion, giving 1649 (instead of 1649.5).
shaalaa.com
  Is there an error in this question or solution?
Chapter 1: Revision of Class 9 Syllabus - Exercises [Page 45]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 1 Revision of Class 9 Syllabus
Exercises | Q 4. (ix) | Page 45
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×