Teachers
Showing posts with label
whether
.
Show all posts
Showing posts with label
whether
.
Show all posts
Wednesday, February 18, 2015
Java program to check whether a number is prime or not
class prime
{
public static void main(String...s)
{
int n,i;
n=Integer.parseInt(s[0]);
for(i=2;i<n;++i)
{
if(n%i==0)
break;
}
if(i==n)
System.out.println("
Number is prime");
else
System.out.println("
Number is not prime");
}
}
Read more »
Older Posts
Home
Subscribe to:
Posts (Atom)