मराठी

Evaluate the following expression as per Java priority and associativity. 35 % 6 * 7 / 5

Advertisements
Advertisements

प्रश्न

Evaluate the following expression as per Java priority & associativity.

35 % 6 * 7 / 5

मूल्यांकन
Advertisements

उत्तर

Priority (Precedence): Modulo (%), multiplication (*), and division (/) all have the same precedence level in Java.

Associativity: Because their precedence is equal, Java evaluates them from left to right.

  • 35 % 6: Evaluates first. 35 divided by 6 leaves a remainder of 5.
  • 5 * 7: Multiplies the result by 7, giving 35.
  • 35 / 5: Divides the result by 5. Since all operands are integers, Java performs integer division, giving a final answer of 7.
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 4. (ii) | पृष्ठ ४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×