Answers for "What are prime numbers"

1

is 33 prime number

33 is prime
Posted by: Guest on October-16-2020
12

prime number

public class Prime {
    public static void main(String[] args) {

        int num = 29;
        boolean flag = false;
        for(int i = 2; i <= num/2; ++i){
            if(num % i == 0){
                flag = true;
                break;
            }
        }

        if (!flag)
            System.out.println(num + " is a prime number.");
        else
            System.out.println(num + " is not a prime number.");
}}
Posted by: Guest on May-25-2020
2

Prime Number

Numbers -- Prime Number
Write a method that can check if a number is prime or not
 
Solution:
public static boolean primeNumber(int num) {

    if(num <= 1){
        return false;
    }

    for(int i = 2; i < num; i++) {
        if(num % i == 0) {
            return false;
        }
    }

    return true;

}
Posted by: Guest on September-29-2021
5

prime number

def is_prime(n):
  if(n<0):
    print("n is not a nature number!")
    return False
  for i in range(1,ceil(n/2)+1):
    if (i != n and i != 1 and n%i == 0):
      return False
  return True
print(is_prime(int(input("number>>"))))
Posted by: Guest on July-10-2021
1

what are prime numbers

Prime numbers: whole numbers greater than 1 that are only divisible 
by 1 and itself.
Posted by: Guest on July-06-2021
-1

What are prime numbers

Numbers with 2- factors.

2 is a composite number because it has less than 2 factors (1, 2)
Posted by: Guest on June-17-2021

Browse Popular Code Answers by Language