To check whether the number is prime or composite
18/01/2013 08:24
public class primecomposite
{
public static void main(String args[])
{
int n=56;
int c=0;
for(int a=1;a<=n;a++)
{
if(n%a==0)
c++;
}
if(c==2)
System.out.println("the number is prime");
else
System.out.println("the number is composite");
}
}