(D) Let the total number of $CDs$ sold be $x$. The total money obtained is $x \times x = x^2$ rupees.
They take turns taking $10$ rupees each,starting with Leela. This is equivalent to dividing $x^2$ by $10$ and finding the remainder.
Let $x^2 = 10q + r$,where $0 \leq r < 10$.
Since Leela takes the first $10$ rupees,the sequence of turns is: Leela,Madan,Leela,Madan,...
If the total number of turns is even,Leela takes the last turn. If the total number of turns is odd,Madan takes the last turn.
However,the problem states they continue until Madan is left with less than $10$ rupees. This implies the remainder $r$ is the amount left for the person whose turn it is next.
Since Leela takes the first $10$,the turns are: $1^{st}$ (Leela),$2^{nd}$ (Madan),$3^{rd}$ (Leela),$4^{th}$ (Madan),...
If the total number of $10$-rupee notes is $q$,and $q$ is odd,the last $10$ rupees is taken by Leela,and the remainder $r$ is left for Madan.
If $q$ is even,the last $10$ rupees is taken by Madan,and the remainder $r$ is left for Leela.
For $x^2$ to have a remainder $r$ such that Madan gets it,$x^2 \equiv r \pmod{10}$ where $q$ is odd.
Testing values: If $x=4, x^2=16, 16=10(1)+6$. Here $q=1$ (odd),so $r=6$ is left for Madan.
If $x=6, x^2=36, 36=10(3)+6$. Here $q=3$ (odd),so $r=6$ is left for Madan.
In both cases,the amount left for Madan is $6$ rupees.