What is the relation between fun and motivation? Are they the same? Are 'having fun in doing something' and 'being motivated to do something' the same thing? 

If not, how are fun and motivation related? Is there any formal definition on this? Would it be possible to be motivated to do something without having fun in it?
As a temporary answer, and based on the comments, I will say that:

Motivation is related to the long term cost and revenue (in the broadest sense) for an activity, i.e. more extrinsic. If the long term revenue is higher than the cost, you might be motivated to undertake the activity.

Fun is related to the short term cost/revenue for an activity, i.e. intrinsic. If the short term revenue is high enough than a certain treshold you will say the activity is fun.

Improvements welcome :-)