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
NNADVOKAT [17]
3 years ago
12

Python Write a program that asks the user for an integer and then prints out all its factors.

Computers and Technology
1 answer:
scoray [572]3 years ago
7 0

Answer:

def display_factors(num):

   for counter in range(1, num+1):

       if num % counter == 0:

           print(counter)

int_num= int(input("Enter a number : "))

print("The factors for {} are : ".format(int_num))

display_factors(int_num)

Explanation:

The function display_factors is used to display all factors of a number entered by a user.

  • In this  for counter in range(1, num+1) the for loop is iterated until counter is greater  to num is false.   Counter variable starts from 1 and ends when it gets greater than the input number.
  • if num % counter == 0: In this statement, each loop  iteration, checks whether a number (num) is exactly divisible by counter. It is the condition for counter to be a factor of num.
  • print(counter) This is used to display factors of an input number
  • int_num= int(input("Enter a number : ")) This statement asks user to enter a number (int_num) which will be an integer.
  • display_factors(int_num) This calls display_factors number to find the factors of an input number.

You might be interested in
Write code that declares a variable named minutes, which holds minutes worked on a job,
Mamont248 [21]

The code that carried out the functions indicated above is stated below. It is not be noted that the code is written in C#

<h3>What is C#</h3>

C# is a type-safe, object-oriented programming language. It is pronounced "see sharp"

<h3>What is the code for the above task?</h3>

Using System;            

public class HoursAndMinutes

{

   public static void Main()

   {

      // declaring minutes variable and assigning 197 as given in question

       int minutes = 197;

     // outputing the total minutes , hours

       Console.WriteLine("{0} minutes is {1} hours and {2} minutes.", minutes, minutes/60, minutes%60);

   }

}

// OUT

Learn more about C#:
brainly.com/question/20211782
#SPJ1

8 0
2 years ago
Develop an sec (single error correction) code for a 16-bit data word. generate the code for the data word 0101000000111001. show
natita [175]

Answer:

010100000001101000101

Explanation:

When an error occurs in data bits, the SEC code is used to determine where the error took place. 5 check-bits are needed to generate SEC code for 16-bits data word. The check bits are:

C16=0, C8=0, C4=0,C2=0,C1=1

Therefore the SEC code is 010100000001101000101

7 0
3 years ago
Read 2 more answers
A characteristic of a 3D model that a 2D model does not have is:
Bas_tet [7]

Answer:

Volume

Explanation:

A characteristic of a 3D model that a 2D model does not have is:

<em>Volume</em>

<em>PLEASE</em><em> </em><em>DO MARK</em><em> </em><em>ME AS</em><em> </em><em>BRAINLIEST UWU</em><em> </em>

3 0
3 years ago
Can someone write me a design brief about a stadium​
Delicious77 [7]

Btw..which dtadium do u want cricket or football!?

3 0
2 years ago
Read 2 more answers
There are information that are in the web view source that may not appear on the web page such as meta name. In addition there c
SCORPION-xisa [38]

Answer:

True on a web page such meta name will not appear in web view source and irrelevant information will be displayed.

Explanation:

Basically web page source is compiled version of HTML script so the end-user he or she tries to view pages system will show only in HTML.

so meta name information and active object information will not be displayed while viewing the web source code instead of that the irrelevant informant ions will be displayed and end-user cannot under anything out of the web source code.

Moreover, even the client side validation script also will not be displayed.

Only HTML will be displayed  

3 0
3 years ago
Other questions:
  • Give an example of an input device, an output device, a storage device, and a networking device.
    10·1 answer
  • Which computer device is used to capture or copy a photograph to place in a report?
    14·1 answer
  • The ____ is the point in the past to which the recovered applications and data at the alternate infrastructure will be restored.
    15·1 answer
  • What is drop shipping and how it works on amazon?
    12·1 answer
  • Submit your 400-word essay that analyzes and evaluates three different examples of digital media. need some help
    14·1 answer
  • 2. Used to drive in or remove screws that fasten electrical wires or other electrical accessories. A. Pliers C. Screwdrivers B.
    15·1 answer
  • I re-made the human version of Daddy Dearest from Friday Night Funkin
    14·2 answers
  • Cora is writing a program to make a motorcycle racing game. If Cora wants the speed of the motorcycle to appear on the screen wh
    5·2 answers
  • It takes Mike 18 minutes to finish reading 4 pages of a book. How long would it take for him to finish 30 pages ?​
    9·1 answer
  • Write a boolean expression that is true if s references the string end.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!