Answer: B. They were written to be codes of laws for early civilizations.
Explanation: Both laws provide a set of rules and duties that people have to respect and fulfill in accordance with the attainment of an ethical and legal standard of living. Hammurabi's code is the Babylonian legal framework for the inhabitants of ancient Mesopotamia, and it can be considered in addition to being a legal, also religious law, because it is a civilization period when kings were "chosen" by god or gods. Ten Commandments are the primary religious law with all norms of conduct and obligations regulating the legal framework, that is, the laws that came from the law of God.
The Hammurabi's code is one of the oldest laws in the world, and is considered the basis or starting point for the development of Jewish, Christian and Islamic laws.
Another similarity is that, for example, in the Hammurabi's code, social classes are clearly divided, starting with nobility, through free people to slaves, therefore there is a social ranking, while according to the Ten Commandments from which a set of books on laws and religious customs has been developed, duties are clearly divided between tribes of Israel.