We study the cusp/core problem using a secondary infall model that takes into account the effect of ordered and random angular momentum, dynamical friction, and baryons adiabatic contraction (AC). The model is applied to structures on galactic scales (normal and dwarfs spiral galaxies) and on clusters of galaxies scales. Our analysis suggest that angular momentum and dynamical friction are able, on galactic scales, to overcome the competing effect of AC eliminating the cusp. The slope of density profile of inner halos flattens with decreasing halo mass and the profile is well approximated by a Burkert's profile. In order to obtain the Navarro-Frenk-White (NFW) profile, starting from the profiles obtained from our model, the magnitude of angular momentum and dynamical friction must be reduced with respect to the values predicted by the model itself. The rotation curves of four lower sideband galaxies from Gentile et al. are compared to the rotation curves obtained by the model in the present paper obtaining a good fit to the observational data. The time evolution of the density profile of a galaxy of 10(8)-10(9) M(circle dot) shows that after a transient steepening, due to the AC, the density profile flattens to alpha similar or equal to 0. On cluster scales we observe a similar evolution of the dark matter (DM) density profile but in this case the density profile slope flattens to alpha similar or equal to 0.6 for a cluster of similar or equal to 10(14) M(circle dot). The total mass profile, differently from that of DM, shows a central cusp well fitted by an NFW model.