11. Primality testing

A prime number is an integer greater than 1 that has no factors other than 1 and itself. For example, 17 is prime because the only positive integers that you can multiply to get 17 are 1 and 17. In contrast, 21 is not prime because 3 × 7 = 21. Integers greater than 1 that are not prime are called composite numbers.

Write a program that determines whether an integer is prime or composite.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset