## solving integral involving floor function

what would be integral [cot(x)]dx where x goes from 0 to pi?
the answer is -pi/2
This question is from AIEEE 2009.
The solution is right here but i cant understand the solution...can anybody explain..??
http://www.narayanagroup.com/aieeeqps/2009.pdf its on page 13 question 70.
Wolfram alpha was unable to solve this...