Why doesn't $\int\lfloor {x}\rfloor~dx=x\lfloor x\rfloor +C$? 
Why doesn't $$\int\lfloor {x}\rfloor~dx=x\lfloor x\rfloor +C?$$

When I tried integrating $\lfloor {x}\rfloor$ initially, I thought of the integral as representing the area beneath the graph and so was successful in finding its indefinite integral. However, when I tried thinking about it from a 'formulaic' perspective, ie without thinking about what the integral really meant, I've become confused:
If we try integrating by parts, we seem to get
$$\int\lfloor {x}\rfloor~dx=x\cdot\lfloor {x}\rfloor-\int x\cdot\frac{d}{dx}(\lfloor {x}\rfloor)~dx=x\lfloor {x}\rfloor+C$$
since I would think that $\frac{d}{dx}(\lfloor {x}\rfloor)=0$.
Please can you explain why my result is wrong? I would guess that it has something to do with the derivative of the floor function being undefined at places where there is jump discontinuity, but I'm not sure.

$x\lfloor x\rfloor$ has a discontinuity at every integer, and cannot be an antiderivative. If you look at the successive discontinuities, they are of amplitude $0,1,2,3,4,\cdots$, and cumulated, $0,1,3,6,10,\cdots$.
So we compensate with
$$\int_0^x \lfloor t\rfloor\,dt=x\lfloor x\rfloor-\frac{\lfloor x\rfloor(\lfloor x\rfloor+1)}2.$$

