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 i)1 ii)0
Answers
Answered by
7
I) When n = 1
X=2
Y= 0
ii) When n = 0
X=1
Y=1
Hope it helps :)
Answered by
1
Output of the above code:
Explanation:
- If n=1, then x=2, y=0.
- If n=0, then x=1,y=1.
Detailed Explanation:
- The above code contains one if statement which will be executed when the n value is greater than 0. So when the n value will be 1, then the if condition will be executed and the value of x and y will be changed because of the expression which is get evaluated when the condition is true.
- So when the n value will be 0, then the value of the x and y will be the same because the value changed statement is not evaluated.
Learn More:
- Output : https://brainly.in/question/11781728
Similar questions
Social Sciences,
5 months ago
Science,
5 months ago
Hindi,
5 months ago
Social Sciences,
11 months ago
English,
11 months ago
Science,
1 year ago
Chemistry,
1 year ago
Chemistry,
1 year ago