हिंदी

Evaluate the following expression where prefix and postfix increment and decrement operator is used. int cm = 24, dc  = 5, re = 8, bq = 1; bq = cm/++dc + cm/re--;

Advertisements
Advertisements

प्रश्न

Evaluate the following expression where prefix and postfix increment and decrement operator is used.

int cm = 24, dc  = 5, re = 8, bq = 1;

bq = cm/++dc + cm/re--; 

System.out.printn("CM=" +cm +"DC=" +dc+" RE=" +re +“BQ=" +bq);

मूल्यांकन
Advertisements

उत्तर

cm/++dc 

++dc (Prefix): Increments dc first (from 5 to 6), then uses it.

24/6 = 4.

cm/re-- 

re-- (Postfix): Uses the current value of re (8) for the operation, then decrements re to 7.

  • BQ = 4 + 3 = 7
  • CM = 24
  • DC = 6
  • RE = 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 3. (iii) | पृष्ठ ४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×