Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The whole purpose of my program is that a user inputs a number and according to that number it then prints out all the prime
The whole purpose of my program is that a user inputs a number and according to that number it then prints out all the prime numbers leading up to the input. So for example, if the input is 20 it'll print out 2, 3, 5, .... all the way to 19. (Since 20 is not prime). This method can print the prime numbers but for some reason it is printing out 1 (1 is not prime). How can I get it to not print 1?
public boolean isPrime (int number) int prime; for (prime = 2; primeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started