used array and loop