multiple object animation in array

hello

I have an array of gameobjects all with an animator on it.
what i want to do this

that i get the animator component from eevery slot that is in the array
but how do i do that?
right now i have this

using UnityEngine;
using System.Collections;

public class targetanimation : MonoBehaviour {
    public GameObject[] targets;

    // Use this for initialization
    void Start () {
        anim = targets.GetComponent<Animator>();
    }
   
    // Update is called once per frame
    void Update () {
            if(Input.GetKeyDown(KeyCode.O))
            {


            }
    }
}

Just do a foreach loop and grab them.