1) First turn off your phone or tablet and remove your sdcard
2) After your phone or tablet turn off you have to press an hold three buttons at a time
power + volume down + home butten and then your phone goes to recovery mode
like picture bellow
3) In recovery mode select Wipe data/ Factory reset after some time device reset then turn on your phone.
Attention : All data like sms , contacts picture will be erased .