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
Jobisdone [24]
3 years ago
6

Write a program that prompts the user for an integer and thenprints out all prime numbers up to that integer. For example,when t

he user enters 20, the program should print out:
2
3
5
7
11
13
17
19
Note: A prime number is not divisible by any number except 1and itself.
Computers and Technology
1 answer:
MaRussiya [10]3 years ago
8 0

Answer:

n=int(input("Enter number upto which you want to print prime numbers:\n"))#taking input of n in integer type..

for i in range(1,n): #looping over 1 to n.

   pr=True  #taking pr to be True..

   for div in range(2,i): #looping over 2 to i..

       if i%div==0:#if i is divisible by div then it is not prime

           pr=False#making pr false

   if pr and i!=1: #condition for printing

       print(str(i))#printing the prime numbers..

       

Explanation:

In the python program we have checked for every integer up to n that is is not divisible by any integer between 2 to n-1 both inclusive if it is then it is not a prime number.

You might be interested in
According to the video, which of the following is communication between two individuals? Intrapersonal Communication Public Spea
DedPeter [7]

Answer:

The Last option: Dyadic Communication AND Interpersonal Communication

is the correct one.

Explanation:

Communication can be defined as the process in which one may convey his thoughts or inquires about things.

There are many types of communications as listed above.

  • Intrapersonal Communication
  • Interpersonal Communication
  • Dyadic Communication
  • Small Group Communication
  • Public Communication
  • Mass Communication
  • Organizational Communication
  • Intercultural Communication.

Under all these, Interpersonal communication and Dyadic communication are the ones that are between two people.

Dyadic communication is the one in which two people relate to exchange thoughts and ideas face-to-face. It is sometimes referred as dialogic relation.

Interpersonal relation can be between two or more than  two persons that may know each other. It is clearly specified in this communication that who listener and speaker are.

<h3>I hope it will help you!</h3>
3 0
3 years ago
Read 2 more answers
What happens when the programmer tries to access an array cell whose index is greater than or equal to its logical size?
just olya [345]

Answer:

When a programmer tries to access an item in an array cell whose index is greater than or equal to the array's logical size, this data element or item is garbage. This means that currently, the item is not the part of the program's useful data. Garbage contains objects or data which will not be used by a program running on it. So the value returned could be either of the two:

  • Value would be an arbitrary or random number if it is an array of numbers. Arbitrary means that the value is not predefined or specified in advance.
  • Value returned would be null if it is an array of objects.

                                                           

 

3 0
3 years ago
How/when should you use student loans?
mote1985 [20]

Answer:

Things you should use your student loan to pay for: Books and supplies; Room and board (meal plans) Off-campus housing; Transportation (gas, bus pass, etc.) Computers; Any equipment you need for classes; Sheets and towels and Things you should not use your student loan to pay for: Pizza and beer for your roomies; Spring break travel; Taking your family out to dinner; Buying a new Mercedes; An outfit for a friend’s wedding; Cleaning services; Entertainment

Explanation:

3 0
2 years ago
Select Packet 10 in the Wireshark top pane and then answer the following questions: Did this handshake complete properly? What i
Yuki888 [10]

Answer:

Yes

32 bytes

No

40 bytes

6 0
3 years ago
Katla is a project manager. One of the programmers on her team comes to her and says that he permanently deleted some code mista
Aleonysh [2.5K]

Answer:

Version Control - Maintains the code log history and changes overtime.

8 0
3 years ago
Other questions:
  • Wich of these is an example of magnetic storage
    11·1 answer
  • Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
    8·1 answer
  • Which of the following is *not* true about logging user and program actions on a computer?
    10·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • What is the purpose of the new window command
    6·1 answer
  • Explain the concept of “survival of the fittest”
    15·1 answer
  • 8
    7·1 answer
  • Types of Hazards Mitigation Measures
    8·2 answers
  • Explain the concepts of GIGO—garbage in, garbage out. Why do you think it’s a helpful concept in coding? How do you think it can
    8·1 answer
  • A.Distance sensor<br> b.Programable microcontroller<br> c.Ambient light sensor<br> d.Wi-Fi
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!