Question: Using Javascript write a public classA01. Write following methods in this class. e)The method largestCoprime returns the largest n-digit coprime for a given integer. The

Using Javascript write a public classA01. Write following methods in this class.

e)The method largestCoprime returns the largest n-digit coprime for a given integer. The integer for which the largest co-prime is being searched, is passed as first argument to the method and the second argument is the number of digits. In case, an n-digit coprime is not possible, -1 is returned. For all other error situations, return -2.

You are not allowed to use for loop in this question; use while or do-while.

You are not allowed to use any Math libraries in this method.

Do not perform any input/output in your methods.

Also, write the main method in your program and test your above methods from main() in a suitable way.However, there is no grade associated with those tests. We will run our own test while grading

Do not use System.exit(0)any where in your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!