Genesis 7:24 and 8:3 say the floodwaters lasted for 150 days, yet; Genesis 7:4, 12 and 17 say it was only forty days. The difference is solved with a simple explanation. Each is referring to two different periods of time. Let us look at these verses again (italics mine):

Genesis 7:12 Updated American Standard Version (UASV)

12 And the rain fell upon the earth for forty days and forty nights.

Notice that the 40-days refer to how long the rain fell—“the rain fell.”

Genesis 7:24 Updated American Standard Version (UASV)

24 The waters prevailed on the earth one hundred and fifty days.

Notice that the one hundred and fifty days refer to how long the flood lasted—“waters prevailed.”

Genesis 8:3 Updated American Standard Version (UASV)

and the waters receded from the earth continually, and at the end of one hundred and fifty days the waters had abated.

Genesis 8:4 Updated American Standard Version (UASV)

And in the seventh month, on the seventeenth day of the month, the ark came to rest on the mountains of Ararat.

Genesis 7:11; 8:13-14 Updated American Standard Version (UASV)

11 In the six hundredth year of Noah’s life, in the second month, on the seventeenth day of the month, on the same day all the fountains of the great deep burst open, and the windows of heaven were opened. 13 In the six hundred and first year, in the first month, the first day of the month, the waters were dried up from upon the earth. And Noah removed the covering of the ark and looked, and behold, the face of the ground was dried up. 14 In the second month, on the twenty-seventh day of the month, the earth was dry.

By the end of the one hundred and fifty days, the water had gone down [Gen 8:3]. Five months from the beginning of the rain, the ark comes to rest on Mount Ararat [8:4]. Eleven months later the waters dried up [7:11; 8:13]. Exactly 370 days from the start (lunar months), Noah and his family left the ark and were on dry ground.