Yes you can leave your answer just like that but there are problems with your answers.
For the first one, I got different answer for the RHS. For the second one, it is not an equation and I don't think your integration is right.
(3y^2 + 2y)y' = xcosx
xyy'=ln(x) ; y(1)=2
for the first one i get y^3 + y^2= (x^2) sin(x) +cos(x) + C (constant)
and the second one is y^2 + ln(x)^2 +4
the problem is there is no way i can define those two as function y of x or function x of y
because of the exponents.
So my question is, if a question is asking for a solution to a differential equation, can we just leave it as that above?