1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
frez [133]
3 years ago
9

Write a JAVA program to generate the list of prime numbers between 100 and 1000 ?

Computers and Technology
1 answer:
Svetllana [295]3 years ago
6 0

First of all, we will need a function that checks if a number is prime or not:

boolean isPrime(int n){

 for(int i=2; i<=math.sqrt(n); i++){

   if(n % i == 0) return false;

 }

 return true;

}

Then, in the main program, we will call this function with all the desired inputs, and we will print the prime numbers:

for(int n=100; n<= 1000; n++){

 if(isPrime(n)) print(n);

}

You might be interested in
What are the services offered by web-based email?​
slega [8]

Answer:

Web based email is a service that allows to access and use electronic mail via web browser.

It allows clients to login into the email software running on a web server to compose, send and receive, delete mails basically.

8 0
3 years ago
If a while loop iterates forever,what is the most likely cause?
miv72 [106K]

Answer:

Runtime error probably. The program won't make it past the while loop in the code.

5 0
2 years ago
Why do we use computers?<br><br>​
Nina [5.8K]

Explanation:

Computers are very useful machines..We use it for creating presentations, creating documents, creating many more things that are made nicely by computer..

6 0
3 years ago
Read 2 more answers
Do opportunity costs only occur when making spending decisions
Naily [24]

Answer:

yes there is opportunity in every thing such as do i buy this car what am i going to miss out on if i buy this what does this offer

Explanation:

6 0
3 years ago
Hey guys,i have a question. 2x + 7x + 1y.how do i simplify it
Nastasia [14]

Answer:

9x+y Lol use photo math :) !!

5 0
3 years ago
Other questions:
  • A knowledge and skills test is a tool support managers use when selecting new employees; it measures an applicant's understandin
    13·1 answer
  • Create a class CitiesAndCountries with at least three methods: class CitiesAndCountries: def add_country(self, country_name): ""
    7·1 answer
  • The Internet is a hierarchical structure linking different levels of service providers whose millions of devices supply all the
    13·1 answer
  • Ron travels extensively. He posts articles, photos, and videos about his experiences on a website. Which type of electronic comm
    9·1 answer
  • PLEASE HELP!!! History abounds with instances in which the work of scientists and artists were affected by the political, religi
    9·1 answer
  • Mark is looking for a position in the IT field that best matches his qualifications. He has an associate degree in the field and
    6·1 answer
  • The major difference between a calculator and a computer, when performing calculations, is that a
    12·1 answer
  • Which flowchart symbol is called the process symbol and contains the steps or actions in the process being depicted?
    6·2 answers
  • What is the purpose the wait block?
    10·1 answer
  • Bits of information are combined into meaningful units so that more information can be held in short-term memory through the pro
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!