By formula,
Sn = 2n[2a+(n−1)d]
Given,
Sn = 90
⇒2n[2×2+(n−1)×8]=90⇒n[4+8n−8]=180⇒n[8n−4]=180⇒8n2−4n=180⇒4(2n2−n)=180⇒2n2−n=4180⇒2n2−n=45⇒2n2−n−45=0⇒2n2−10n+9n−45=0⇒2n(n−5)+9(n−5)=0⇒(2n+9)(n−5)=0⇒2n+9=0 or n−5=0⇒2n=−9 or n=5⇒n=−29 or n=5.
Since, no. of terms cannot be negative.
∴ n = 5.
By formula,
an = a + (n - 1)d
a5 = 2 + (5 - 1) × 8
= 2 + 4 × 8
= 2 + 32 = 34.
Hence, n = 5 and an = 34.