Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Program to solve finger problem.
- #
- # Put some sample values in x, y, and z.
- #
- x = 4
- y = 16
- z = 24
- #
- # Initialize biggest to zero. If it never gets updated, this flags the case
- # where no variable is an odd number.
- #
- biggest = 0
- if x % 2: #check x odd
- biggest = x
- if (y % 2) & (y > biggest): #check y odd and bigger than x
- biggest = y
- if (z % 2) & (z > biggest): #check z odd and bigger than x or y
- biggest = z
- #
- # Now print biggest odd integer or no odd integer.
- #
- if biggest: #check biggest > 0
- print "Biggest odd integer is " + str(biggest)
- else:
- print "No odd integer found."
- #
- # End of program.
- #
Advertisement
Add Comment
Please, Sign In to add comment