English

The following is a segment of a program: if (n > 0) { x = x + l; y = y +1; } What will be the value of x and y, if n assumes a value 1? - Computer Applications

Advertisements
Advertisements

Question

The following is a segment of a program: 

x = 1; y = 1;

if (n > 0) 
   { 
   x = x + l; 
   y = y +1; 
   } 

What will be the value of x and y, if n assumes a value 1?

Answer in Brief

Solution

x = 2

y = 2  

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.09: Iterative Constructs in Java - EXERCISES [Page 122]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.09 Iterative Constructs in Java
EXERCISES | Q III. 1. (a) | Page 122
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×