Revenue is:

profit is revenue minus costs:

Now find the extrema of this by differentiating and setting the derivative to zero and solving for the critical values of q, the critical value that maximises the profit will be the profit maximising output.

q=50 and profit=6000

CB