To find the percentage of trees that were infected with the virus, you can use the following formula:
\[ \text{Percentage} = \left( \frac{\text{Number of infected trees}}{\text{Total number of trees}} \right) \times 100 \]
In this case, the number of infected trees is 6, and the total number of trees is 40. Plugging in the values:
\[ \text{Percentage} = \left( \frac{6}{40} \right) \times 100 \]
Calculating the fraction:
\[ \frac{6}{40} = 0.15 \]
Now multiply by 100:
\[ 0.15 \times 100 = 15 \]
Therefore, the percentage of trees that were infected is:
\[ \text{Percentage} = 15% \]
So, the answer is 15%.