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
Salsk061 [2.6K]
3 years ago
6

Your program will search for prime numbers. You will first ask the user for the range of values to search, and use for loops to

progress through all the numbers chosen. Note to determine if a number is a prime number, you must check to find out if there are any values besides 1 and itself that divide into it evenly. If any other numbers found then it is not prime. To check if any number is divisible, use the modulus operator which gives the value of the remainder of a division. List off all prime numbers found within a range given by the user. Do not list off numbers that are not prime. Also output at bottom the total number of primes from. See sample output at bottom of project sheet. Hint: first write the code that will determine if a given single number is prime or not, then put it in a larger loop. write in java.
Computers and Technology
1 answer:
Stells [14]3 years ago
7 0

Answer:

Java code is given below

Explanation:

import java.util.Scanner;

public class Prime {

public static void main(String args[]) {

int first, last, flag = 0, i, j;

Scanner s = new Scanner(System.in);

System.out.println("Enter the lower limit :");

first = s.nextInt();

System.out.println("Enter the upper limit :");

last = s.nextInt();

System.out.println("The prime numbers in between the entered limits are :");

int x = 0;

for (i = first; i <= last; i++) {

for (j = 2; j < i; j++) {

if (i % j == 0) {

flag = 0;

break;

} else {

flag = 1;

}

}

if (flag == 1) {

x++;

System.out.println(i + " ");

}

}

System.out.println("Total number of prime numbes between " + first + " and " + last + " are " + x);

}

}

You might be interested in
I need neveahbowe to see this.
Elden [556K]

Answer:

try dming the one of the staff here is joy123333's brainly.com/messages/204840

Explanation:

hope this helps

6 0
3 years ago
Explain why the process of sketching in engineering might resemble a loop or a cycle.
Valentin [98]

Answer:The process of sketching in engineering might resemble a loop because of the design process.

Explanation: The design process is a loop or cycle to improve a design. So, sketches will be shown to other engineers and they will improve on the design until it is effective and efficient.

6 0
3 years ago
Read 2 more answers
You are now going to prepare some reports for the company. Measurements are in metres and volume
romanna [79]

if you follow me and like and mark in brainliest answer only I will tell the answer

4 0
2 years ago
How does one build social capital?
iren2701 [21]

Answer:

by building on line presence

Explanation:

If you put yourself out there in multiple social sites you will build a following

3 0
2 years ago
Imagine that you work for an organization that has no Internet use policy. Employees use the Internet in whatever way they want
Strike441 [17]

Answer: Yes

Explanation:

It would force the company to either enforce the policy and fire all of its employees.

8 0
1 year ago
Other questions:
  • It is a good idea to use more than one typeface in a document when _____.
    8·2 answers
  • Which information technology job has the lowest predicted 10-year growth? computer programmer software developer computer suppor
    13·1 answer
  • Elise has just edited two photos of her cat and three different photos of her dog. She needs to save all five of these photos in
    5·2 answers
  • Which relationship is possible when two tables share the same primary key? one-to-one one-to-many many-to-one many-to-many
    15·2 answers
  • which telecommunications service allows internet and telephone service to work over the same phone line
    13·1 answer
  • Question 5 (1 point)
    5·1 answer
  • Nielsen purchases scanner data from retail transactions to track the sales of consumer packaged goods, gathered at the point of
    14·1 answer
  • In working on the conceptual design of the new database, Ken determines that the "office" field in one of the tables must includ
    8·1 answer
  • A parent process calling _____ system call will be suspended until children processes terminate.
    14·1 answer
  • Some hackers are skillful computer operators, but others are younger inexperienced people who experienced hackers refer to as?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!