Let the first term, common difference and the number of terms of the AP are a, d and n respectively.
Given that, first term (a) = -5 and last term (l) = 45
Sum of the terms of the AP=120⇒Sn=120
We know that, if last term of an AP is known, then sum of n terms of an AP is,
Sn=n2(a+l)
⇒ 120=n2(−5+45)⇒120×2=40×n
⇒ n=3×2⇒n=6
Number of terms of an AP is known, then the nth term of an AP is,
l=a+(n−1)d⇒45=−5+(6−1)d
⇒ 50=5d⇒d=10
So, the common difference is 10.