Q. Consider the following code (draw a flowchart diagram if it helps):
x = int (input ("Enter value of 'x' :- "))
y = int (input ("Enter value of 'y' :- "))
if x > 2: #1
if y > 2: #2
z = x + y #3
print ("z is", z) #4
else: #5
print("x is", x) #6
What is the output if:
S. No. |
Input values |
Output produced |
(a) |
x = 2 and y = 5? |
|
(b) |
x = 3 and y = 1? |
|
(c) |
x = 1 and y = 1? |
|
(d) |
x = 4 and y = 3? |
|
Answer :-
S. No. |
Input values |
Output produced |
(a) |
x = 2 and y = 5? |
x is 2 |
(b) |
x = 3 and y = 1? |
No output. |
(c) |
x = 1 and y = 1? |
x is 1 |
(d) |
x = 4 and y = 3? |
z is 7 |
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )