1.

1. 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 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? k == i - j k == j - i k == i + j The relationship depends on start and end

Answer»

Many PROGRAMMING issues (particularly on Brilliant) frequently inquire as to whether certain numbers have remarkable characteristics.


Knowing how to actualize this in the code is regularly a test and these CALCULATIONS come up MUCH of the time when managing harder programming issues.


By TAKING care of these issues, you build up a "munititions stockpile" of helpful calculations.



Discussion

No Comment Found