Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- n = int(input("Choose the Set of Numbers from 0 to N: \n-> "))
- count = 0
- a = b = rem = 0
- product = 1
- for i in range (1, n + 1):
- try:
- a = random.randint(0, n)
- b = random.randint(0, n)
- product = a * b
- rem = product % 10
- if rem == 0:
- count += 1
- except ValueError:
- print("Only Integers please!")
- print(f"The Number of 0's in last places are {count}")
Advertisement
Add Comment
Please, Sign In to add comment