Menu
Question Index
...

Write a program to check if a given number is prime number or not? A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. For eg. 3, 5, 7, 11, 13 are prime numbers where as 2, 4, 9, 15 are not.



class IsPrime
{
    public static void main(String s[])
    {
        System.out.println(prime(37) ? "37 is prime" : "37 is not prime");

    }


    public static boolean prime(int input)
    {
        boolean result = false;
        return result;
    }

}

Doubts

Problems

Topic: for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App