Question: please help!! Write an error-free Java program to do the following things. 1. Inputs two integers from the user. (You may input both of the

 please help!! Write an error-free Java program to do the following

please help!!

Write an error-free Java program to do the following things. 1. Inputs two integers from the user. (You may input both of the integers at the same time, but your best bet is to input the integers one at a time.) The limit of 2 is to simplify testing: you should write your program so that it can be easily extended to work with more than 2 numbers. 2. If the input integer is not between 1 and 5000000 (non-inclusive), then keep prompting the user to re-enter the number till the integer is within the proper range. 3. Determine if the input number is prime. If N is prime, then print a message stating that it is prime. 4. If the number is not prime, say it is not prime and determine the smallest factor of the number (other than 1). To summarize, you must read in two numbers, make sure they are within in the proper range, determine if each number is prime, and, if not prime, determine its largest factor. There are many ways to do this program, but you must include at least one for loop in your program. Sample output: Input integer 1: 10000000 Input integer 1: 379 Your number 379 is prime. Input integer 2: 5917 The smallest non-unity factor of 5917 is 61 Remember to put the usual header at the top of the program and to submit via Canvas

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!