Let \( S \) represent the initial total stock of all fruits. Let \( b \) denote the number of bananas and \( a \) denote the number of apples.
The stock of mangoes is 40% of \( S \), which is \( \frac{2S}{5} \).
The total number of fruits sold is the sum of mangoes sold, apples sold, and bananas sold.
This is expressed as \( \frac{2S}{10} + 96 + \frac{4a}{10} \), which is given to be equal to \( \frac{S}{2} \).
Simplifying the equation gives \( \frac{S}{5} + 96 + \frac{2a}{5} = \frac{S}{2} \).
Multiplying by 10 to clear the denominators results in \( 2S + 960 + 4a = 5S \).
Rearranging the terms, we get \( 3S = 4a + 960 \).
Solving for \( S \) yields \( S = \frac{4a + 960}{3} = \frac{4a}{3} + 320 \).
For \( S \) to be an integer, \( a \) must be divisible by 3. Additionally, the term \( \frac{4a}{10} \) implies that \( a \) must be divisible by 5.
Therefore, the smallest value for \( a \) that satisfies both divisibility conditions (multiples of 3 and 5) is the least common multiple of 3 and 5, which is \( a = 15 \).
Substituting this value of \( a \) into the formula for \( S \):
\( S = \frac{4 \times 15}{3} + 320 = 20 + 320 = 340 \)
The correct answer is (C): 340