Follow these steps:
If you paired an Apple Watch with your iPhone, unpair your Apple Watch.
Back up your iOS device.
Tap Settings > iCloud. Scroll down and tap Sign Out. In iOS 7 or earlier, tap Delete Account.
Tap Sign Out again, then tap Delete from My iPhone and enter your password.
Sign out of the iTunes & App Store. Go to Settings > iTunes & App Store > Apple ID > Sign Out.
Go back to Settings and tap General > Reset > Erase All Content and Settings. If you turned on Find My iPhone, you might need to enter your Apple ID and password.
If asked for your device passcode or Restrictions passcode, enter it. Then tap Erase [device].
Hope it Works