Buying used iPhone5c - need to know about iCloud
There are two possible scenarios:


The device is up and running, and you can unlock it with the four digit code. If that's the case go to Settings -> iCloud and choose logout at the bottom of the page. Then you only need the password of the account.
The device was restored to factory settings. In this case activation lock would be active and you need to know the AppleID and the matching password. If you don't know these you need the original receipt and an appointment at your Apple Store to unlock it. The receipt needs to contain your name, otherwise you need help from the person whose name is on the receipt.