For a given A.P., for example 1,2,3,.... what is the formula to find the sum of the nth to kth elements ?
Like, if I want to find the sum from 5 to 10, what should I do ?
Should I use the standard formula,to find the sum till kth element and then deduct the sum till the nth element ?
If this is not the right approach, what is right ?
You have the right idea, just not the right formula or notation.
Suppose our arithmetic sequence is $$a_1, a_2, a_3, \ldots, a_n, \ldots, a_k, \ldots,$$ where $n \le k$, and let $d = a_2 - a_1$ be the common difference. Then we have for every positive integer $m$, $$a_m = a_1 + (m-1)d. \tag{1}$$ Now also define $$S_m = \sum_{i=1}^m a_i = \sum_{i=1}^m a_1 + (i-1)d = m a_1 + d \frac{(m-1)m}{2} = \frac{m}{2}(2a_1 + (m-1)d) = \frac{m(a_1 + a_m)}{2}. \tag{2}$$ This is the formula for the sum of the first $m$ terms. So the sum of the terms from $a_n$ to $a_k$, inclusive, is simply $$S_k - S_{n-1} = \frac{k(a_1 + a_k)}{2} - \frac{(n-1)(a_1 + a_{n-1})}{2}. \tag{3}$$ But this formula assumes you know the values of $a_1$, $a_{n-1}$, and $a_k$. What if you have only $n$, $k$, $a_n$, and $a_k$? For instance, if I give you $$n = 5, \quad k = 11, \quad a_n = a_5 = 38, \quad a_k = a_{11} = 80,$$ how do you proceed? Well, we can first find $d$ with the formula $$d = \frac{a_k - a_n}{k - n}, \tag{4}$$ which in our case yields $$d = \frac{80 - 38}{11 - 5} = \frac{42}{6} = 7.$$ Then we can find $a_1$ using Equation $(1)$ above: $$a_5 = 38 = a_1 + (5-1)7,$$ hence $a_1 = 10$. Now we can substitute everything in Equation $(3)$ to get $$S_k - S_{n-1} = \frac{11(10+80)}{2} - \frac{(5-1)(10+38-7)}{2} = 413.$$ And we can check this works by adding up all the terms manually: $$a_5 + a_6 + \cdots + a_{11} = 38 + 45 + 52 + 59 + 66 + 73 + 80.$$