Advertisements
Advertisements
प्रश्न
Evaluate the following expression as per Java priority & associativity.
1234 % 100 – 1234/100
मूल्यांकन
Advertisements
उत्तर
Priority (Precedence): Modulo (%) and division (/) have higher precedence than subtraction (–), so they are evaluated first.
Associativity: Since % and / share equal precedence, they evaluate from left to right.
- 1234 % 100: Leaves a remainder of 34.
- 1234 / 100: Performs integer division, discarding the remainder, which gives 12.
- 34 – 12: Subtraction completes, giving a final answer of 22.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 1: Revision of Class 9 Syllabus - Exercises [पृष्ठ ४५]
