0% found this document useful (0 votes)
23 views1 page

Java Exp 10

Udy

Uploaded by

Prasad Kalal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Java Exp 10

Udy

Uploaded by

Prasad Kalal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

// ILLUSTRATE A JAVA PROGRAM TO CHECK WHETHER A NUMBER IS PRIME OR NOT

class Prime

public static void main(String [] args)

int N = 4;

int flag = 0;

for (int i = 2; i <= N/2; ++i)

if (N%i==0)

flag = 1;

break;

if (flag == 1)

System.out.println(N+" is not a prime number");

else

System.out.println(N+" is a prime number");

OUTPUT:-

You might also like