* Formal: Il a sept ans. (pronounced "eel ah set ahn")
* Informal: Il a 7 ans. (pronounced "eel ah set ahn")
Both options are grammatically correct. The difference lies in the formality of the situation. The first option uses the full word "sept" (seven) while the second uses the numerical digit "7".
Here are some other ways to express the same idea in French:
* Il est âgé de sept ans. (He is seven years old, literally "He is aged of seven years.")
* Il a 7 printemps. (He is 7 years old, literally "He has 7 springs" - a poetic way to say it)