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
Sidana [21]
4 years ago
7

Write a program that prompts the user for an integer and then prints all prime numbers up to that integer.

Computers and Technology
1 answer:
nataly862011 [7]4 years ago
3 0

Answer:

import java.util.Scanner;

public class New

{

   public static void main(String[] args)

   {

       int num;

       int prime;

       Scanner var=new Scanner(System.in);

       System.out.println("Enter a number: ");

       num=var.nextInt();

       for(int i=2;i<num;i++)

       {

           prime=0;

           for(int j=2;j<i;j++)

           {

               if(i%j==0)

                   prime=1;

           }

           if(prime==0)

               System.out.println(i);

       }

   }

}

Explanation:

Using Java Programming Language the program as implemented above will prompt a user to enter a number, for example the user enters 5,

It will print

2

3

which are the prime numbers up to the integer 5

You might be interested in
Which behaviors might lead someone to have a low credit score?
Dovator [93]
Spending more than you have and not paying it back on your bill.

7 0
3 years ago
Read 2 more answers
How should you complete the code A - valid = false B- valid = true
JulsSmile [24]

Answer:

A. for an if-else statement in python, if the condition is false, The else statement is executed.

B. if the condition of the if-statement is true, the indented block of code is executed.

Explanation:

The if-statement is a conditional statement in programming for decision making. It is also known as branching as it makes decisions based on two paths. It comes with another keyword called 'else'.

The If-else statement makes a decision based on the output of a condition which is defined in the if-statement. If the condition is met, the code block just after the if-statement is executed, but the else-statement block is executed if otherwise.

8 0
3 years ago
cell d1 contains the value 7.877 you want cell d1 to display this value as 7.9 how can you accomplish
Georgia [21]

Answer:

You round?

Explanation:

6 0
4 years ago
The ________ feature introduced by instant messaging shows whether a person is logged in and available to answer a question, pic
tester [92]

Answer:

The correct approach is "Presence awareness".

Explanation:

  • The willingness, at designated occasions, to see which one is available on the internet. When using the IM framework, that very many IM systems show a list of user groups attached to the system. A current model of the IGI Social website is being used by oneself.
  • With either the growing prevalence of Internet chat apps, a Presence Awareness model has been proposed by German IT professionals.
5 0
3 years ago
Daria would like a certain company to publish her math book. She creates a presentation about the features and benefits of using
lisabon 2012 [21]

Answer:

B: A business proposal

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • What e-reader technology males a screen that is easy to read and extends battery life
    6·1 answer
  • Charges of the opposite tend to repel each other.
    9·2 answers
  • How do buffers work?
    14·1 answer
  • ____________ facilitates the processes that help an organization function by applying information and communication technologies
    5·1 answer
  • 50) Universal Containers has an integration that runs nightly to update the Product (Product2) object in Salesforce with updated
    9·1 answer
  • Your long and short term goals (career or job etc)? ANSWER FAST!!!
    6·1 answer
  • ____ is one of the primary operations of a computer.
    10·1 answer
  • Mention five of the format tools use to edit a picture in a word document<br>​
    13·1 answer
  • The action displayed in the status bar while pointing-
    7·1 answer
  • List three natural defects of wood<br>​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!