1. I have to defecate.

2. I got to defecate.
3. I gotta defecate.
4. I have got to defecate.
5. I need to defecate.

6. I have to urinate.
7. I got to urinate
8. I gotta urinate.
9. I have got to urinate.
10. I need to urinate.
[Are they all grammatical and formal?]

1, 5, 6, and 10 are correct.