Numbers that proceed nouns should take the opposite gender
of those nouns. Furthermore, they should carry the marker that is determined by their grammatical function in the sentence. The noun itself has to be in the genitive case because this combination will create an Idaafa.
a. I met five students (f). قابلتُ خَمسَ طالباتٍ.
b. Five students (m) came.خَمسَةُ طلابٍ. حضَرَ