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
A web directory is a web page that conducts searches of the web to find the words or expressions that you enter? true or false.
Sav [38]
The answer to this is true! hope i helped!
4 0
3 years ago
What is storage unit in computer and five examples of storage units.<br>​
Juliette [100K]

Answer:

the storage unit of a computer is known as the term which is used to indicate storage capacity.

Explanation:

Five units of storage units are:-

1) byte

2) kilobyte

3) megabyte

4) gigabyte

5) terabyte

7 0
2 years ago
Read 2 more answers
How to use a state value in stylesheet in react native.
lana66690 [7]

Answer:

Change this code:

return <View style={[styles.container, backgroundColor: this.state.bg]}/>

for this code:

return <View style={[styles.container, {backgroundColor: this.state.bg}]}/>

3 0
2 years ago
Each TextField has a text property that's returned by its textProperty method as a StringProperty. The StringProperty method ___
masha68 [24]

Answer:

B: Bind

Explanation:

JavaFX property binding permits the synchronization of the value of two properties in such a way that whenever there is a change in one of the properties, there is an immediate update on the value of the other property. In this way, The StringProperty method bind receives an ObservableValue as an argument. When the ObservableValue changes, the bound property is updated accordingly.

4 0
3 years ago
Six causes of data lost
Serhud [2]
Hard drive failures

Accidental deletions

Computer viruses and malware infections



Power failures
6 0
3 years ago
Other questions:
  • Individually or in a group find as many different examples as you can of physical controls and displays.a. List themb. Try to gr
    15·1 answer
  • What are the benefits of using presentations to organize and deliver information?
    8·1 answer
  • Where is the spell checker found in excel?
    7·2 answers
  • Harmful programs used to disrupt computer operation, gather sensitive information, or gain unauthorized access to computer syste
    10·1 answer
  • Susan has always wanted to be a veterinarian. When doing her research, she answers all self-assessments geared toward that caree
    13·1 answer
  • When entering data in Access if the data is entered using an Access form, that data is stored in a table or tables. TRUE FALSE
    12·1 answer
  • Project manager Kevin has to create a project team organizational chart. Which activity should he perform before creating this c
    9·1 answer
  • Explain the concept of “survival of the fittest”
    15·1 answer
  • Which part of the brain controls the movement of muscles​
    6·1 answer
  • What is the final gear reduction of a compound gear reduction of 36 to 12 for the first stage and 60 to 12 for the second stage?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!