Design and implement a procedure named reverseFactorial

profileVerifiedEducator
 (Not rated)
 (Not rated)
Chat

Design and implement a procedure named reverseFactorial. This procedure should take one

integer parameter x. When x is a positive integer, this procedure should return the smallest positive

integer n for which n! (i.e. 1*2*3*...*n) is greater than or equal to x. For example:

reverseFactorial(24) should return 4 since (1*2*3*4) = 24 but (1*2*3) < 24;

reverseFactorial(119) should return 5 since (1*2*3*4*5) > 119 but (1*2*3*4) < 119.

//Requires: None

//Modifies: None

//Effects: Returns the smallest positive integer n for which n!

// (i.e. 1*2*3*...*n) is greater than or equal to x, for positive

// integer x. Otherwise returns 1.

public static int reverseFactorial(int x) {

//write the code here}

    • 4 years ago
    Answer attached
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      HM91.txt