Answer:
1/4
Step-by-step explanation:
There are floor(40/6) = 6 integers in the range that are divisible by 6.
There are floor(40/8) = 5) integers in the range that are divisible by 8.
One of those, 24, is divisible by both 6 and 8, so is counted twice. Then the number of unique numbers 1 to 40 that are divisible by 6 or 8 is ...
6 + 5 - 1 = 10
The probability of selecting one of those at random is ...
10/40 = 1/4