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]
2 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]2 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
Mel is a research scientist at a health sciences center. His job requires him to analyze large amounts of data in short periods
blondinia [14]

In the case above, Mel needs a  desktop computer with a fast processor.

<h3>What is data for a computer?</h3>

Computer data is known to be a form of information processed or saved by a computer. This information is saved as text documents, images, audio clips, software programs and others.

Hence due to the volume of work and in In the case above, Mel needs a  desktop computer with a fast processor.

See options below

23

Mel is a research scientist at a health sciences center. His job requires him to analyze large amounts of data in short periods of time.

Select the best computer for Mel.



A handheld tablet computer



A desktop computer with two screens



A desktop computer with a fast processor



A portable laptop computer

Learn more about data  from

brainly.com/question/19243813

#SPJ1

4 0
1 year ago
What is the user requirements of an educational app
VARVARA [1.3K]
Ummmmm I don’t know but I wanna know now.....
7 0
2 years ago
Which can be used to plan a program?
Marina86 [1]

Answer:

Pseudocode.

Hope this helps you...

Explanation:

8 0
3 years ago
Read 2 more answers
You try to enter your name into a cell that accepts a numeric value. What error would you receive? A. #NAME B. #VALUE C. #REF D.
UNO [17]

Answer:

<h2>Option B: #VALUE</h2>

is the correct answer.

Explanation:

<h3>Reasons of #VALUE error:</h3>
  • When cells are not given the expected type of value.
  • If cells are left blank unnoticeable or for giving a null value.
  • For entering dates and other numerical data in text form.
<h3>Correcting and fixing #VALUE error:</h3>

This type of error can only be fixed by finding the cell in which there is wrong data entered and correct it.

Fixing the #VALUE error is tricky as some functions automatically ignore the data that is invalid.

<h3>EXAMPLE:</h3>
  • Suppose a cell contains the value as cost of the object and in order to make it 0, NA is inserted into the cell.
  • While making total of all the costs, that particular cell might cause #VALUE error.
  • Following image attach will help you clear the concept.

I hope it will help you!

4 0
3 years ago
Read 2 more answers
How do you fix The lag on your zsnes emulator
GenaCL600 [577]
Try resetting the phone if that doesn’t work do a hard reset
7 0
2 years ago
Other questions:
  • Helen has no experience in security. She would like to earn a certification that demonstrates that she has the basic knowledge n
    15·1 answer
  • Which are the best examples of costs that should be considered when creating a project budget?
    11·1 answer
  • GIVING BRAINLIEST What does output allow a computer to do? Display information Receive information Do complex math problems Do m
    6·2 answers
  • Which of the following is true regarding packaged software and custom software? Group of answer choices Packaged software are ap
    13·1 answer
  • Select the online reading comprehension tool that best fits the description. This tool lets users change text from one language
    6·2 answers
  • Assign the size of userInput to stringSize. Ex: if userInput is "Hello", output is: Size of userInput: 5
    7·1 answer
  • PLEASE HELP, Answer Correctly..Will give a bunch of brainlist points ​
    10·1 answer
  • Taking a group of recipes and identifying the similarities is an example of _____.
    13·1 answer
  • How are the functions different and how do i determine the answer
    5·1 answer
  • You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you shoul
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!