+1 vote
54 views

In the code fragment on the right, start and end are integer values and $prime(x)$ is a function that returns true if $x$ is a prime number and $false$ otherwise. At the end of the loop:

i := 0; j := 0; k := 0;
for (m := start; m <= end; m := m+1){
k := k + m;
if (prime(m)){
i := i + m;
}else{
j := j + m;
}
}
1. $k < i+j$
2. $k = i+j$
3. $k > i+j$
4. Depends on $start$ and $end$

B. $k = i + j$

Whatever be the value of m, the value added to k is also added to exactly one of i and j.

1
2