DNA is forms a double helix shape/strand. The rule of base pairing is pretty much something that you just need to know by heart. A (adenine), T (Thymine), G (Guanine), and C (Cytosine) and the 4 bases that make up DNA.
***** The most important part is to know that A always pairs with T and G always pairs with C *****
So, the double helix strand of DNA is made up of two strands - kind of like a ladder - one strand is the original, while the other is a replicate of the original strand that is formed through different steps of polymerase reaction etc.
So, for example, let's say strand 1 has this code: ATGCTAGCTGATCG (I made this up, probably doesn't code for anything). But, knowing this, what will it's replicate of second strand look like?
Original strand: ATGCTAGCTGATCG
Replicate Strand: TACGATCGACTAGC
So, you can see from the above example that to form the replicate strand, you just insert the base that pairs with the one from the original strand. A-T and G-C!
Hope that helped!