The transverse momentum (pT) spectra of inclusively produced Λc+ baryons are measured via the exclusive decay channel Λc+→pK−π+ using the CMS detector at the LHC. Spectra are measured as a function of transverse momentum in proton-proton (pp) and lead-lead (PbPb) collisions at a nucleon-nucleon center-of-mass energy of 5.02 TeV. The measurement is performed within the Λc+ rapidity interval |y|