Question
I need help with the flowchart! A prime number is an integer greater than 1 whose only factors are 1 and itself. A factor is
I need help with the flowchart!
A prime number is an integer greater than 1 whose only factors are 1 and itself. A factor is an integer that can be divided evenly into another number. For example, 6 is not a prime number because it has 1, 2, 3 ,6 as its factors. While 11 is a prime number because the factors of 11 are only 1 and 11. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.
Write a method isPrime() with a formal parameter of int type, and aboolean type return to check if a number is a prime number. When a number is prime, return true, otherwise, return false.
Ask an input from console, show all the prime numbers from 2 to the number of your input. You need to call the method isPrime in your main method.
The result should be in following format:
2, 3, 5, 7 .
Requirements:
- Define the method with a formal parameter of int type, and aboolean type return
- Create a flowchart of your design for both main method and isPrime method.
- Ask an input from console and use number 1000 as input to test and take a screenshot of this result.
Step 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