For this problem we need to use the quotient rule
u = x u' = 1
v = e^x v' = e^x
so then we can put it together
dy/dx = vu'-uv'/v^2
dy/dx = e^x- x e^x/ (e^x)^2
you can factor the top
dy/dx = e^x(1-x)/(e^x)^2
then we can simplify
dy/dx = 1-x/e^x