Answer:
In Python:
import random
di4 = 0; di5 = 0; di6 = 0
for i in range(10):
num = random.randint(1,100)
if num%4 == 0:
di4+=1
if num%5 == 0:
di5+=1
if num%6 == 0:
di6+=1
print("There are "+str(di4)+" numbers accept division by 4")
print("There are "+str(di5)+" numbers accept division by 5")
print("There are "+str(di6)+" numbers accept division by 6")
Step-by-step explanation:
This imports the random module
import random
This initializes the count of division by 4, 5 or 6 to 0
di4 = 0; di5 = 0; di6 = 0
This iteration is repeated 10 times
for i in range(10):
This generates a random number
num = random.randint(1,100)
Check if number is divisible by 4. If yes, increase div4 by 1
if num%4 == 0:
di4+=1
Check if number is divisible by 5. If yes, increase div5 by 1
if num%5 == 0:
di5+=1
Check if number is divisible by 6. If yes, increase div6 by 1
if num%6 == 0:
di6+=1
Print reports
print("There are "+str(di4)+" numbers accept division by 4")
print("There are "+str(di5)+" numbers accept division by 5")
print("There are "+str(di6)+" numbers accept division by 6")