25% of the apples are sour because 100 - 75 = <<100-75=25>>25

The average price of an apple sold is $.4 because .75(.5) + .25(.1)= .4

He got 100 apples because 40 / .4 = <<40/.4=100>>100

# Answer

100
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Chang's Garden has two kinds of apples. Sweet ones and sour ones. He can sell the sweet ones for $.5 an apple. The sour ones sell for $.1 an apple. 75% of the apples he gets are sweet and the rest are sour. If he earns $40, how many apples did his trees give him?
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
100
Chang's Garden has two kinds of apples. Sweet ones and sour ones. He can sell the sweet ones for $.5 an apple. The sour ones sell for $.1 an apple. 75% of the apples he gets are sweet and the rest are sour. If he earns $40, how many apples did his trees give him?
train