This video will teach you how to make a TNT Cannon in Minecraft Java and Bedrock
Steps
1. Join a world where you have operator commands on, cheats on, and make sure you are in creative mode
2. Type the command /give @s repeating_command_block
3. Get an unbreakable block, such as bedrock and allow (To get allow, type the command /give @s allow)
4. Build the unbreakable block 2 blocks high and mine the bottom one
5. Build a 3x3x3 frame and add holes in the center to the sides you want to shoot the TNT
6. Turn on coordinates
7. Mine the block on top of the hole and stand in the hole
8. Type in command block /summon TNT x y z
9. Place the unbreakable block on top of the hole back up
10. Set the command block setting from (Needs Redstone) to (Always Active)
If you want to expand the cube here is how many TNTs can it shoot from the hole
4x4x4: 4 TNTs
5x5x5: 9 TNTs
6x6x6: 16 TNTs
7x7x7: 25 TNTs
8x8x8: 36 TNTs
9x9x9: 49 TNTs
10x10x10: 64 TNTs