To harmonize a melody, you simply play a chord which contains a note from that melody on the first beat of each bar. In time, you could also add another chord on the third beat of the bar. There is always more than one possible chord, but some sound better than others. The more songs you learn and analyze, the easier it becomes to find the right chords to play. If you look at the scale and chords above, you will notice that the notes C and G appear in more than one of the chords. This means that if you were harmonizing a melody in the key of C, you could try both chords wherever one of these notes appear on the first beat of a bar and see which sounds best. The following example is a melody in C major harmonized with chords I, IV and V . Learn it and then transpose it to all the other keys.
Although most melodies can be harmonized using only chords I, IV and V , it is common to add one or more of the remaining chords (II, III, VI and VII) to create a different feeling. These other chords are called secondary chords. As with primary chords, the secondary chord chosen for the harmony in any given bar should contain the melody note which occurs on the first or third beat of that bar (wherever the chord changes). Here is the melody from the previous example harmonized with both primary and secondary chords. Once again, learn it and then transpose both the melody and the chords to all the other keys.