answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print non-prime numbers in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can a nonprime multiplied by a nonprime ever result in a prime?

NO!!! By the fact that you are multiplying two numbers together, the answerv is ALWAYS composite.


Does a nonprime multiplied by a nonprime ever result in a prime?

No, a nonprime number multiplied by a nonprime number will be a nonprime number.


Does a nonprime divided by a nonprime equal a nonprime?

A nonprime number divided by a nonprime number could be either a prime number or a nonprime number. For example, the nonprime number 64 divided by the nonprime number 32 equals the prime number 2. As an example of the other case, the nonprime number 100 divided by the nonprime number 25 equals the nonprime number 4.


Explain why multiplication of nonprime numbers never result in a prime?

The products of non-prime numbers have more than two factors.


Does a nonprime divided by a nonprime ever result in a prime?

Yes. For example, 52 ÷ 4 = 13.


How do you write a program in java to read ten numbers and print sum of ten integers?

Add the numbers into one variable as you read them in. But if you prefer, you can read the numbers into an array and then use a loop to add the numbers together.


Write in BlueJ to print lucky numbers?

To print lucky numbers in java, you must give the following program: class example { static public void main(String[] args) { System.out.println("Lucky number is your favourite number which is your DOB"); } }


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


What is java program on computers?

#!/usr/bin/perl print 'java program';


How can you print a table of 5 in java by getting values from user?

look at the print


Does 1 go into 36?

Absolutely. 1 is a factor of all prime (and nonprime) numbers. 1 times the number is the number. Therefore, 1 is a factor of irrational numbers such as pi.


Java code to print prime numbers from 1 to 10?

System.out.println("2, 3, 5, 7"); There are so few you dont need to calculate it