Dear student.
Let us solve this by integration
let an elemental mass dm of length dx be located at a distance x from centre of rod.
Length of rod = L and mass = m
Mass per unit length of rod = m/l
Mass of dm = (m/l) x dx
MI of dm about centre of rod =
1)...MI of rod about the central axis =
2)...MI of rod about pivotal axis, perpendicular to one end.
Regards