English

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

Advertisements
Advertisements

Question

The following is a segment of a program: 

x = 1; y = 1;

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

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

Answer in Brief

Solution

x = 1

y = 1

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. (b) | Page 122
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×