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
Rudik [331]
3 years ago
6

write a program that asks the user to enter a positive integer, then prints a list of all positive integers that divide that num

ber evenly, including itself and 1, in ascending order. when you run your program, it should match the following format: please enter a positive integer: 12 the factors of 12 are: 1 2 3 4 6 12 the file must be named: factors.py
Computers and Technology
1 answer:
Stolb23 [73]3 years ago
3 0

Answer:

<em>The program is written using python</em>

<em>See explanation section for detailed explanation; as the program does not accommodate comments.</em>

<em>Program starts here</em>

num = int(input("please enter a positive integer: "))

print("The factors of",num,"are:")

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

    if num % i == 0:

         print(i)

Explanation:

This line prompts the user for input

num = int(input("please enter a positive integer: "))

This line prints a string literal which states the factors of the input number

print("The factors of",num,"are:")

The next line is a for statement that iterates all positive numbers from 1 till the inputted number

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

This next line checks for the factors of the user input by checking for remainders.

    if num % i == 0:

Lastly, the factors are printed

         print(i)

You might be interested in
Which of the following is a safe work practice to protect you from electrocution hazards?
Flura [38]
What are the answer choices?
7 0
3 years ago
HINTS;
ExtremeBDS [4]
Good job! please mark as branliest?!
4 0
2 years ago
Which of the following formats allow visual, video, and sound capability and can be uploaded to certain social networking sites?
insens350 [35]
It is Microsoft work
This is because
6 0
3 years ago
What is what is a network that is easy to maintain and cheap ​
kifflom [539]

Answer:

Click at the pic above and the ans will appear.

Hope it helps :)

4 0
3 years ago
Write a program that prompt the user to enter the coordinate of two points (x1, y1) and (x2,y2), and displays the slope of the l
zzz [600]

Answer:

Here is code in C++.

//include headers

#include <bits/stdc++.h>

using namespace std;

//main function

int main() {

//variables to store coordinates

float x1,x2,y1,y2;

cout<<"Please Enter the coordinate of first point (x1,y1): ";

// reading coordinate of first point

cin>>x1>>y1;

cout<<"Please Enter the coordinate of second point (x2,y2): ";

// reading coordinate of second point

cin>>x2>>y2;

//calculating Slope of the line that connects these points

float m=(x2-x1)/(y2-y1);

cout<<"Slope of the line that connects these two points is :  "<<m<<endl;

}

Explanation:

Declare four variables x1,x2,y1,y2 to store the coordinate of both points.

Read the coordinate of both the point from user. Calculate the slop of the

line which connects these two points with the formula m=(x2-x1)/(y2-y1).

Output:

Please Enter the coordinate of first point (x1,y1): 1 3                                                                                                        

Please Enter the coordinate of second point (x2,y2): 5 12                                                                                                      

Slope of the line that connects these two points is :  0.444444  

3 0
3 years ago
Other questions:
  • How do I get rid of this little tool bar????
    14·1 answer
  • A network administrator is using packet tracer to mock up a network that includes iot devices. What can the administrator do fro
    15·1 answer
  • Will the Python code below print something? And will it terminate?
    9·1 answer
  • A college team's BCS football ranking is comprised of three elements:1) the Harris Poll score, 2) the Coaches Poll score, and 3)
    12·1 answer
  • ____________ are collected from several entities at the same point in time.
    13·1 answer
  • Assuming that we only support BEQ and ADD instructions, discuss how changes in the given latency of this resource affect the cyc
    7·1 answer
  • Jennifer works as a clerk in a company. The essential function of her job is typing on a keyboard. If she develops crippling art
    11·1 answer
  • Discuss briefly general-purpose graphicsprimitives that contain 2D graphics library.
    15·1 answer
  • How do programmers recognise patterns, generalise and abstract information
    13·1 answer
  • Physical education is the body's ability to function effectively and efficiently without excessive farigue. TRUE/FALSE
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!