हिंदी

Evaluate the following expression as per Java priority and associativity. 22 + 33 – 11 – 10 * 2

Advertisements
Advertisements

प्रश्न

Evaluate the following expression as per Java priority & associativity.

22 + 33 – 11 – 10 * 2

मूल्यांकन
Advertisements

उत्तर

Priority (Precedence): Multiplication (*) has higher precedence than addition (+) and subtraction (–), so it evaluates first.

  • 10 * 2: Multiplies first, giving 20. The expression simplifies to 22 + 33 – 11 – 20
  • 22 + 33: Addition and subtraction share equal precedence and evaluate from left to right. This gives 55.
  • 55 – 11: Continues from left to right, giving 44.
  • 44 – 20: The final subtraction completes, giving an answer of 14
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. (x) | पृष्ठ ४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×