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 of the following statement is true?
Alexxx [7]

Answer:

b. the IP address can be spoofed, so if you want to read response from the deceived party, you can use IP spoofing to hide yourself.

Explanation:

3 0
3 years ago
What is a man-in-the-middle attack​
VMariaS [17]

Answer: An attack where the attackers will interrupt a data transfer happening between parties and in which they will pretend to be the legitimate parties.

Explanation: For example think about two people writing letters to each other back and forth. However you, the attacker can intercept the letters and effectively change the message/contents of the letter going to the other person. This is probably not the best explanation, but simply put a man-in-the-middle attack is when an attacker interupts a transfer and pretends to be the legitimate source.

4 0
3 years ago
Read 2 more answers
Using recursion, write a program that asks a user to enter the starting coordinates (row, then column), the ending coordinates (
Luden [163]

Answer:

The program in Python is as follows

def Paths(row,col):

if row ==0 or col==0:

 return 1

return (Paths(row-1, col) + Paths(row, col-1))

row = int(input("Row: "))

col = int(input("Column: "))

print("Paths: ", Paths(row,col))

Explanation:

This defines the function

def Paths(row,col):

If row or column is 0, the function returns 1

<em> if row ==0 or col==0: </em>

<em>  return 1 </em>

This calls the function recursively, as long as row and col are greater than 1

<em> return (Paths(row-1, col) + Paths(row, col-1))</em>

The main begins here

This prompts the user for rows

row = int(input("Row: "))

This prompts the user for columns

col = int(input("Column: "))

This calls the Paths function and prints the number of paths

print("Paths: ", Paths(row,col))

4 0
3 years ago
Consider the Google Trends graph of dogs and cats. Give a plausible explanation or hypothesis for the spike in dog searches that
Nataly [62]

Answer:

The correct answer for: Consider the Google Trends graph of dogs and cats. Give a plausible explanation or hypothesis for the spike in dog searches that occurred between 2014 and 2015 that would lead to further investigation or research. Give your explanation and what you would want to investigate next. Is: b. dog rescues someone.

Explanation:

All right. The topic I would lie t investigate next is dogs rescue someone. Because first of all, the word dog by itself wouldn't generate such a spike in searches. c) option new dog breed seems quite difficult because for a new dog breed to be created. There has to be a hundred-year period to make the genetic design and also it has to be allowed by the kennel club as well as organizations that seek for dog's health and wellbeing. That leaves dog attack and dog rescues someone in the final mile. A dog attack is something not very common but that happens. Nevertheless, even though it is relevant it wouldn't as impressive and pivoting as a dog rescuing someone. The reason behind my posture is that as a story is not very promising, it could be a little bit yellow journalism and won't be as accepted and shared as a good act from a dog.

7 0
3 years ago
What is one way to recognize whether an online source has been copyrighted
lara [203]
Copy and paste a sentence or a paragraph and search it and usually that site the person copyrighted it from will pop up, and/or if it's a image, it was have a name on it somewhere in the corner. 
7 0
3 years ago
Read 2 more answers
Other questions:
  • The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
    8·1 answer
  • When adding shapes to a presentation, the outline can be one color, and the fill must be the exact same color.
    12·2 answers
  • Advantages of bursaries??????
    11·1 answer
  • Match the items with their respective descriptions. organizes files make files easily searchable keeps track of file creation an
    14·1 answer
  • Lab Assignment 3 Phase 1 Create a class named Car, which is supposed to represent cars within a Java program. The following are
    6·1 answer
  • Meaning of sperm count
    5·2 answers
  • PLZ ANSWER ALL MY QUESTION. Which line of code will display the variable num rounded to the nearest tenth?
    14·1 answer
  • Match the definition
    14·1 answer
  • I want know answer for best way to copy formula on MS Access
    10·1 answer
  • Which of the following is the best way to add a lengthy explanation to Excel data without being limited to cell sizes and restri
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!