Question: Write two subroutines to perform the following (Using Java): 1. Determine if a number is prime -Number is passed on the stack (as a parameter)
Write two subroutines to perform the following (Using Java):
1. Determine if a number is prime
-Number is passed on the stack (as a parameter)
-If the number is prime, return a 1 on the stack (return value)
-If the number is not prime, return a 0 on the stack (return value)
2. Determine the next prime number in a sequence
-Number is passed on the stack (as a parameter)
-Place the smallest prime number greater than or equal to the number on the stack (return value)
*Write a main program to test your subroutines.
*Function 2 must call 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
