edited by
670 views

1 Answer

2 votes
2 votes

S = {1,2,3,4,5.......n }

Sum = 0;

 

while ( j in S)

{

      Sum = Sum +1

}

       j = j + 1

Return Sum ;

Answer will be 4.

 

edited by

Related questions

5 votes
5 votes
1 answer
1
dd asked Jun 8, 2020
1,212 views
How many pairs $(x,y)$ such that $x+y <= k$, where x y and k are integers and $x,y>=0, k 0$.Solve by summation rules.Solve by combinatorial argument.
3 votes
3 votes
2 answers
2
dd asked Feb 25, 2017
826 views
Prove the identity:$$\begin{align*} &\sum_{i=0}^{n}\sum_{j=0}^{i} a_ia_j = \frac{1}{2}\left ( \left ( \sum_{i=0}^{n}a_i \right )^2 + \left ( \sum_{i=0}^{n}a_i^2 \right )\...
1 votes
1 votes
1 answer
4
SomnathKayal asked Mar 28, 2016
537 views
$(a) \sum_{k = 0}^{m} \left \lfloor \sqrt k \right \rfloor$$(b) \sum_{k = 0}^{m} \left \lfloor \sqrt {k^{3}} \right \rfloor$Is there any quick way to find the formula for...