Tap Keep or Delete for data on your iOS device, such as iCloud calendars, Safari data, reminders, and contacts.
Enter your Apple ID password, and tap Turn Off.
iOS 10.3 or later:
Go to Settings > [your name].
Scroll down and tap Sign Out.
Enter your Apple ID password and tap Turn Off.
Turn on the data that you want to keep a copy of on your device.
Tap Sign Out.
Tap Sign Out again to confirm that you want to sign out of iCloud.
Removing Private Accounts from an Android Device
Older Android Devices
Open your device Settings.
Scroll down to “Accounts” or “Accounts and Sync”.
Tap the account you wish to remove.
On the next screen, tap the 3-dot menu icon or “More” option found at the top-right corner of the screen. Then select “Remove” or “Remove account” option.
Newer Android Devices
Open your device settings.
Look for “Cloud and accounts> Accounts” or “Users & accounts”
Tap the account you wish to remove.
Select the “Remove Account” option.
Right after selecting remove account you will be prompted to remove the account. Tap "Remove Account".