Final answer:
Mary sold 0 cups.
Step-by-step explanation:
To find the number of cups that Mary sold, subtract the number of cups she sold from the number of cups she prepared.
In this case, Mary prepared 40 cups and sold 58 cups, so the calculation would be: 40 - 58 = -18.
However, since Mary cannot sell negative cups, the answer should be 0 cups. Therefore, Mary sold 0 cups.