For each call of the method below, display the value that is returned public int retVal(int a, int b) { int c; if (a > b) { c = a; } else if (b % a == 0) { c = b; } else { c = b + (a - (b % a)); }...


For each call of the method below, display the value that is returned


public int retVal(int a, int b) {


    int c;


    if (a > b) {


        c = a;


    } else if (b % a == 0) {


        c = b;


    } else {


        c = b + (a - (b % a));


    }


    return c;


}



Read the following arguments from the keyboard and pass them to retVal()


Arguments passed



  1. retVal(4, 2)

  2. retVal(5, 4)

  3. retVal(5, 13)

  4. retVal(x, y)

  5. retVal(m, n)



Output



  1. 4

  2. 5

  3. 15

  4. 20

  5. 8


For d and e what values are passed to produce 20 and 8?



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here