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
Canada’s energy plan, named __________, makes three governmental agencies accountable for safeguarding Canada’s environment.
stepan [7]

Answer:

Canada launched the national Generation Energy Council of leading Canadians, who proposed principles to the Government of Canada on how to build our energy future. Today, these principles guide government decisions to support Canadian families, businesses, and communities. Together, we are: saving energy powering clean communities.

Explanation:

8 0
2 years ago
A _____ is one in which the size of the web page and the size of its elements are set regardless of the screen resolution..
mixas84 [53]

Answer: Fixed layout

Explanation:

Fixed layout  is the arrangement of any website page or webpage that is featured with fixed size on any screen resolution .Fixed layout displays all the components and tools of the page with a fixed percentage.

  • The width or percentage cannot be changed or altered as it is fixed.The user experiences same width of the page and elements in any computing resolution.

7 0
3 years ago
These things are commonly found on the front of desktop computer cases:
jok3333 [9.3K]

USB ports, headphone jack/microphone port, and of course, a power button.

3 0
3 years ago
Net neutrality refers to the idea that Internet service providers (ISPs), including cable Internet and wireless carriers, should
Vedmedyk [2.9K]

Answer:

True is the right answer.

Explanation:

The term net neutrality can be defined as the principle which states that all internet service providers treat all communication channels i.e wired or wireless channels equally.

In net neutrality, there can not be any discrimination on the basis of the website, user, protocol, hardware or application.

In net neutrality, the internet service provider can not charge the user on the basis of some specific content.

Hence the most appropriate answer is true.

8 0
3 years ago
Read 2 more answers
A(n) ______ database stores data in tables that consist of rows and columns.
melisa1 [442]
The answer is a spreadsheet.
4 0
3 years ago
Read 2 more answers
Other questions:
  • When did internet came to existence?
    12·1 answer
  • Another html/css assignment, drop css code below, thank you
    15·1 answer
  • PreparedStatement ps = connection.prepareStatement("select firstName, mi, lastName from Student where lastName = ?"; ps.setStrin
    5·1 answer
  • Which does plug-and-play refer to?
    14·1 answer
  • Which type of cloud computing offers easily accessible software and applications on the machines?
    7·1 answer
  • A circle surrounding the earth at the equator would consist of ___________ “degrees” of angular measurement.
    15·1 answer
  • Remember that kid who would always ask you for your food, even though he packed his own lunch.
    8·2 answers
  • Um i'm new here... and i don't know really how to use this... i was wondering if som 1 can help me
    6·2 answers
  • How do i stop my computer from automatically connecting to a wireless network
    5·1 answer
  • A CPU has just been powered on and it immediately executes a machine code instruction. What is the most likely type of instructi
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!