DityaSen

Untitled

May 24th, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import random
  2.  
  3. n = int(input("Choose the Set of Numbers from 0 to N: \n-> "))
  4. count = 0
  5. a = b = rem = 0
  6.  
  7. product = 1
  8.  
  9.  
  10. for i in range (1, n + 1):
  11.     try:
  12.         a = random.randint(0, n)
  13.         b = random.randint(0, n)
  14.         product = a * b
  15.         rem = product % 10
  16.         if rem == 0:
  17.             count += 1
  18.     except ValueError:
  19.         print("Only Integers please!")
  20.    
  21.  
  22. print(f"The Number of 0's in last places are {count}")
Advertisement
Add Comment
Please, Sign In to add comment