-----------------------------------------------------------------------------------------------------
Starting out with Java: From control structures through objects
Chapter 5
Programming Challenges
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
13. isPrime Method
A prime number is a number that is evenly divisible only by itself and 1. For example, the number 5 is prime because it can be evenly divided only by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Write a method named isPrime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Demonstrate the method in a complete program.
Tip: Recall that the % operator divides one number by another, and returns the remainder of the division. In an expression such as num1 % num2, the % operator will return 0 if num1 is evenly divisible by num2.
Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (Page 316). Pearson Education.
Kindle Edition.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Bitcoin Address - 12uPbtoTBgxKG3ppxC2NSJYmmr5qipsbds
email - kakradetome@gmail.com
Thanks :)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
On this page of the site you can watch the video online 5.13. isPrime Method - Java with a duration of hours minute second in good quality, which was uploaded by the user Kakra Detome 27 November 2016, share the link with friends and acquaintances, this video has already been watched 6,041 times on youtube and it was liked by 57 viewers. Enjoy your viewing!