Math, asked by kalaiselvan227, 1 year ago

Hi,
Could anyone please answer the following questions and explain.

Question :
In the code fragment below, start and end are integer values and gcd(x,y) is a function that computes the greatest common divisor of x and y.

i := 0; j := 0; k := 0;
for (m := start; m <= end; m := m+1){
if (gcd(m,9381) > 2){
i := i + m;
k := k + m;
}else{
j := j + m;
k := k + m;
}
}

At the end of the loop which of the following expresses a valid relation between i, j and k?
(a) k == i - j
(b) k == j - i
(c) k == i + j
(d) The relationship depends on start and end

Answers

Answered by sneharam23
0

ans:

option c)   k==i+j


Similar questions