In the code fragment given below, start and end are integer values and prime(x) is a function that returns true if x is a prime number and false otherwise.

i := 0; j := 0; k := 0;
for (m := start;m <= end;m := m+1){
if (prime(m)){
i := i + m;
k := k - m;
j := j - m;
k := k + m;

At the end of the loop:

k == i-j.

k == j-i.

k == -j-i.

Depends on start and end.


sumitverma's picture

The value of i + j + k is 0 initially, and also at the end of each iteration of the loop.
Thus k = −j − i at the end of the loop.

Did not found what you are looking for, Ask your doubt or Help by your contribution

Enter your search keyword:

Search form


Here is a chance to join biggest community of technical Students,
Tutors with FREE learning resources and so much more.
It takes less then 60 seconds.