#### Answer

The number of sides in the polygon is $~6$

#### Work Step by Step

Let's consider a trinomial in this form: $~x^2+bx+c$
To factor this trinomial, we need to find two numbers $r$ and $s$ such that $r+s = b$ and $r\times s = c$
Then the next step is to rewrite the trinomial as follows:
$~x^2+bx+c = (x+r)~(x+s)$
We can rewrite the given equation with $D=9$:
$\frac{n~(n-3)}{2} = D$
$\frac{n~(n-3)}{2} = 9$
$n~(n-3) = 18$
$n^2-3n = 18$
$n^2-3n - 18 = 0$
To factor the left side of this equation, we need to find two numbers $r$ and $s$ such that $r+s = -3~$ and $~r\times s = -18$. We can see that $(-6)+(3) = -3~$ and $(-6)\times (3) = -18$
We can solve the equation as follows:
$\frac{n~(n-3)}{2} = D$
$\frac{n~(n-3)}{2} = 9$
$n~(n-3) = 18$
$n^2-3n = 18$
$n^2-3n - 18 = 0$
$(n-6)~(n+3) = 0$
$n-6=0~~$or $~~n+3=0$
$n = 6~~$ or $~~n=-3$
Since the number $n$ must be a positive number, $n=6$
The number of sides in the polygon is $~6$