2 Samuel 24:13 "So Gad came to David, and told him, and said unto him, Shall seven years of famine come unto thee in thy land? "
1 Chronicles 21:11.12 "So Gad came to David, and said unto him, Thus saith the LORD, Choose thee Either three years' famine; "
This apparent contradiction between the references in 2 Samuel and 1 Chronicles comes from a problem in the passing on of the text. From the point of understanding what the verses say, both passages are clear and have no problems, therefore the difficulty must have to do in some way with the text itself and how it has been passed on, or else there is a problem in the translation.
Some modern Bibles already solve this problem by substituting the word "seven" in 2 Samuel 24:13 with the word "three". In the Hebrew text, numbers were written by the use of letters of the alphabet, there were no separate characters as we have them today in addition to the letters of the alphabet. Now, the letter used for "three" and that for "seven" looked somewhat similar, and it could very well be that this mistake crept into the text by a scribal error when copying this passage.
From the content of the whole statement of the seer Gad it appears logical that David was told by God of a period of THREE and not seven years of famine as consequence for his doings; for one, there were THREE alternatives, and then in both the other cases it concerned also items with the number THREE THREE months of destruction before his enemies, and THREE days of pestilence in the land. This emphatic number for the whole passage was given correctly in the section in 1 Chronicles 21, but it needs to be restored in the translation of the section in 2 Samuel 24 where it speaks of seven instead of three years of famine.
God's Word is conclusive and free of any contradictions. Here we see an example of a contradiction which is caused by a human error in the process of copying of the text which then made it into the later copies of the biblical text.