Choose an open flat spot to build your cannon (ex: beach, boat, flat plain, flat top of a mountain, etc.)
Build the walls (sides) of the cannon.
Place the half slab in the front of the cannon.
Place a water source in the back of the inside of the cannon
Place two TNT in the locations shown in the picture.
Set the TNT the nearest to the water source and wait until the set TNT looks as if it's gonna blow.
Quickly set the 2nd TNT on the slab right before the 1st TNT ignited is just about to blow.
Watch your TNT propel to its target! (The range should be around 10-20 blocks).