Virat Kohli hit an unbeaten century as India beat Sri Lanka by seven wickets in the C.B. Tri-series in Hobart.