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
You work part time at a computer repair store. You are in the process of building a new computer system. The customer wants a mo
kumpel [21]

Answer:

Building of a New Computer System

Explanation:

Specification

a motherboard having dual core 64 bit dual core processor with 8 GB RAM of dual channel memory support with 16x PCI Express slot for video card and firewire support.

8 0
4 years ago
Why is cyberbullying so devastating to many people beyond just the victim?
Lynna [10]

Answer: If the situation goes undetected, it can lead to serious situations, self-harm, and damaged relationships. According to Superintendent Alex Geordan, some common long-term effects of cyberbullying include depression, low self-esteem, unhealthy addictions, trust issues, and poor mental health.

6 0
3 years ago
Which type of software is the most similar to database software?\
kykrilka [37]
The answer is graphics
5 0
3 years ago
The iso 14001:2004 standards require documentation of a firm's environmental program. Which component requires a plan to improve
In-s [12.5K]

The component that requires a plan to improve performance in resource use and pollutant output is the environmental management system.

<h3>What is a pollutant?</h3>

Pollutant simply means a substance that is harmful to the environment.

In this case, the component that requires a plan to improve performance in resource use and pollutant output is the environmental management system.

Learn more about pollutant on:

brainly.com/question/25537936

#SPJ12

8 0
2 years ago
What would the internet be like today if there was no World Wide Web?
Anvisha [2.4K]

Answer:

Non existent probably

Explanation:

3 0
3 years ago
Other questions:
  • A company database consists of 10,000 sorted names, 40% of whom are known as good customers and who together account for 60% of
    13·1 answer
  • Consolidating a system's physical and time resources is known as ________________.
    13·1 answer
  • The amount of vertical space between lines within paragraphs
    9·1 answer
  • A Windows user has been successfully saving documents to the file server all morning. However, the latest attempt resulted in th
    9·2 answers
  • 20 PTS URGENT!!! Derek’s organization uses an emerging technology that uses specialized software to place an image on an object,
    6·2 answers
  • Why might you complete a 1040 instead of a <br> 1040ez
    11·2 answers
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • Codehs dartboard 3.12.4
    9·1 answer
  • Difference between multi-national and global company​
    11·2 answers
  • Can i have help for a ggogle class room
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!