Data Structure and Algorithms in Java

A prime number is a natural number greater than 1 that has no positive divisors other than
1 and itself.
On the other hand, a composite number is a natural number greater than 1 that is not a
prime number.
For example, 5 is prime, as only 1 and 5 divide it, whereas 6 is composite, since it has the
divisors 2 and 3 in addition to 1 and 6.
Write a java method isPrimeNum that takes the number n, and checks whether the number
is prime or composite. The method should print at the end a message that indicates whether
n is prime or composite.

asked by ahmad

Respond to this Question

First Name

Your Answer

Similar Questions

  1. math

    Can someone help me with prime and composite numbers? Prime numbers are counting numbers that can be divided evenly bt only two numbers:1 and themselves. A prime number can also be described as a counting number with exactly two
  2. PRE-CALC

    A number is selected at random from the set {2, 3, 4, … ,10}. Which event, by definition, covers the entire sample space of this experiment? A) The number is greater than 2. B) The number is not divisible by 5. C) The number is
  3. algebra

    Are the following true or false? 1. The difference of two natural numbers is always a natural number. 2. The sum of two natural numbers is always a natural number. 3. The quotient of two natural numbers is always a natural number.
  4. Math

    Find the smallest number N such that: The number of divisors of N is A. The number of divisors of A is B. The number of divisors of B is C. The number of divisors of C is 3. Details and assumptions The divisors include 1 and the
  5. Math

    The number p is the product of three different positive prime numbers greater than 2.If the sum of these three prime number is also prime, what is the smallest possible value for p? Won't the 3 number be 3-5-11? Thanks
  6. Math

    Tickst number 1-15are placed in a hat ,2 Tickets Are drawn at random without replacement find the probability that both Numbers Are Greater then 9 B.) the First Number is Prime and the Second number is Composite?
  7. Maths

    Different between two natural number is 24 the bigger number is four time greater than the smaller number find the number
  8. math

    1) the average of four positive numbers is 15. The second number is 2 times the first number. The third number is twice the second. The last number is the last square of the first number. what is the largest number? 2) suppose
  9. Math

    There are 13 flavbors at a local ice cream parlor. Is the number 13 a prime number or a composite number? If it is composite, write the number as the product of prime numbers
  10. Maths

    Difference between the two natural number is 24 . The bigger number is four time greater than the smaller number , find the numbers.

More Similar Questions