why does my 98 Subaru forester keep stalling? on 1998 Subaru Forester

the check engine light comes on and off as well as the atoiltemp light it stall when I start it first thing in the morning and when I slow down for lights or stop signs some times its fine and other times it stall all the time

Asked by for the 1998 Subaru Forester