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
Employers hiring for entry-level positions in Hospitality and Tourism expect workers to learn the required skills after they sta
vovikov84 [41]
<h2>have basic skills required to do the job</h2>

Explanation:

expect workers to learn the required skills after they start:  

The must have basic skills then only they can employ to upgrade further skill

have the required skills before they start:  

We cannot expect all the skills. Skill will develop through experience too.

acquire the necessary skills through education: only if they have necessary education for performing the job, then only the company will short-list. So, this is an entry criterion.

have basic skills required to do the job: This is the right answer. This aspect is enough for an entry-level position.

8 0
3 years ago
Read 2 more answers
The 7-bit ASCII code for the character ‘&amp;’ is: 0100110 An odd parity check bit is now added to this code so 8 bits are trans
Lorico [155]

Answer

First part:

The transmitted 8-bit sequence for ASCII character '&' with odd parity will be 00100110. Here leftmost bit is odd parity bit.

Second part:

The invalid bit sequence are option a. 01001000 and d. 11100111

Explanation:

Explanation for first part:

In odd parity, check bit of either 0 or 1 is added to the binary number as leftmost bit for making the number of 1s in binary number odd.

If there are even number of 1s present in the original number then 1 is added as leftmost bit to make total number of 1s odd.

If there are odd number of 1s present in the original number then 0 is added as leftmost bit to keep the total number of 1s odd.  

Explanation for second part:

A valid odd parity bit sequence will always have odd number of 1s.

Since in option a and d,  total number of 1s are 2 and 6 i.e. even number. Therefore they are invalid odd parity check bit sequences.

And since in option b and c, total number of 1s are 5 and 7 i.e. odd numbers respectively. Therefore they are valid odd parity check bit sequences.

7 0
3 years ago
How to change screen resolution in windows 10?
pav-90 [236]
The easiest way is to hit the Windows icon on your keyboard, look for the Settings app, and look for screen resolution in the search bar.
7 0
3 years ago
Please help me with coding!
tresset_1 [31]

Answer:

key code space

Explanation:

the transformation

6 0
3 years ago
Read 2 more answers
Can someone plz answer these questions plz
goldenfox [79]

Answer:

True

Explanation:

Hopefully this helps!

8 0
3 years ago
Other questions:
  • What does deploying a computer mean?
    5·2 answers
  • You are working on a router that has established privilege levels that restrict access to certain functions. you discover that y
    5·1 answer
  • SONET: is a standard for optical transmission that currently operates at Terabit per second speeds is almost identical to the IT
    7·1 answer
  • A user who has special security and access to a system, such as the right to assign passwords, is called a ____.​ a. ​ technical
    8·1 answer
  • How to do a linear equations
    8·1 answer
  • What is the exclusive legal right granted to all authors and artists that gives them sole ownership of their work to print, publ
    5·2 answers
  • Why would we need to consider implementing our business blockchain application not on Bitcoin but Ethereum?
    5·1 answer
  • Write features of Fifth Generation of computer?​
    12·2 answers
  • Trees 1. 2. 3. 4. 5.​
    6·1 answer
  • Select the correct word to complete the sentence.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!