There is an Apple article that explains what to do if you have forgotten an iPhone or iPad passcode. Click on the following link: How to remove your iPhone, iPad, or iPod touch passcode without a computer - Apple Support
If that option is not available, you will need to use a computer. See:
If you forgot your iPhone passcode - Apple Support
or
If you forgot your iPad passcode - Apple Support