Both A and B are two years old.
补充:
用 the age of ...翻的话应该是:
The age of both A and B is two.
age 要用单数.