Step 1: Use the principle of inclusion and exclusion.
Let:
\( M \) be the set of students who like mathematics,
\( S \) be the set of students who like science,
\( |M \cup S| \) be the number of students who like mathematics or science.
We are given:
\( |M| = 30 \) (students who like mathematics),
\( |S| = 25 \) (students who like science),
\( |M \cap S| = 15 \) (students who like both mathematics and science).
The number of students who like either mathematics or science is given by the principle of inclusion and exclusion:
\[
|M \cup S| = |M| + |S| - |M \cap S| = 30 + 25 - 15 = 40.
\]
Step 2: Calculate the number of students who do not like either.
The total number of students is 50, so the number of students who do not like either subject is:
\[
50 - |M \cup S| = 50 - 40 = 5.
\]
Thus, the correct answer is:
\[
\boxed{5}.
\]