हिंदी

Given: g = ++p + y++ + ++y + p++ + x++; If p = 2, y = 3, x = 5 then what will be the value of g?

Advertisements
Advertisements

प्रश्न

Given: g = ++p + y++ + ++y + p++ + x++;

If p = 2, y = 3, x = 5 then what will be the value of g?

विकल्प

  • 19

  • 18

  • 20

  • 21

MCQ
Advertisements

उत्तर

19

Explanation:

Given: p = 2, y = 3, x = 5

Expression is interpreted as: g = ++p + y++ + ++y + p++ + x++

Calculation:

  • ++p → p becomes 3, value = 3
  • y++ → value = 3, then y becomes 4
  • ++y → y becomes 5, value = 5
  • p++ → value = 3, then p becomes 4
  • x++ → value = 5, then x becomes 6

g = 3 + 3 + 5 + 3 + 5 = 19

Therefore, the value of g is 19.

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 1. (xii) | पृष्ठ ४२
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×