Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- ORIGINAL
- Use the trace table below to help you answer (a), (b) and (c) below.
- What would be the values of integer variables x, y and z after execution of
- these statements if the initial values of x and y are
- (a) 2 and 7
- (b) -4 and -4
- (c) 27 and 3
- z = x
- IF x = y THEN
- x = x * x
- y = (x + y) / 2
- ELSE
- IF x < y THEN
- y = y * y
- z = y - x
- ELSE
- IF x > 0 THEN
- z = x/y
- ENDIF
- ENDIF
- y = 200
- ENDIF
- OUTPUT x, y, z
- """
- # Trace Tables
- """
- Use the trace table below to help you answer (a), (b) and (c) below.
- What would be the values of integer variables x, y and z after execution of these statements if the initial values of x and y are
- (a) 2 and 7
- (b) -4 and -4
- (c) 27 and 3
- ####
- CONVERTED
- ####
- """
- x = int(input("Enter number"))
- y = int(input("Enter number"))
- z = x
- if x == y:
- x = x * x
- y = (x + y) / 2
- else:
- if x < y:
- y = y * y
- z = y - x
- else:
- if x > 0:
- z = x/y
- y = 200
- print( x, y, z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement