year

1

She retired when she was 50 years.
She retired when she was 50.
She retired when she was 50 years old.

To give someone’s age, say ‘She was 50’ or ‘She was 50 years old’. Do not stop after years.

2

I am a student of 20 years old.
I am a 20-year-old student.

When the age comes before a noun, use year, not years, and join the words with hyphens: ‘a 20-year-old student’.

See OLD (2)