public class v3
{
public static void main()
{
int b=0,i;
for(i=1;i<=100;i++)
{
for(j=1;j<=i;)
{
if(i%j==0)
{
b=j;
System.out.print(b+" ");
b=0;
}
}
}
}
}
Chat with our AI personalities
Implement this method:
public static boolean prime(int n) {
if(n 0) return false;
}
return true;
}
Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.
Yes
for arrays you can list the different arrays and what attributes that you give to them.
First of all, it's "JDK", not "jdk", and "Java", not "java". What do you mean by "Java new edition"? I do not find that term when I Google for it. "Java 2 SE" is a brand name for very old, obsolete versions of Java, between version 1.2 and 1.4, inclusive. The current version of "Java SE" (Java Standard Edition), as it is now called, is version 7, with support still available for version 6. These versions are also called 1.7 and 1.6, respectively. See <http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html>
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.