In order to know which endings to use, you'll have to learn declination of the nouns.
Ανανάς is the nominative. Ο ανανάς είναι κίτρινος. The pineapple is yellow.
Ανανά is the accusative. Τρώω τον ανανά. I eat the pineapple.
and the genitive: Η φλούδα του ανανά είναι τραχιά. The skin of the pineapple is rough.