J.C. Penney posts profit, but cuts forecast