Simple Python Program that gets the Factors of a number

1

This program accepts one positive integer input and print all the factors of that number.

What I did here in my code is that in the for loop, there is a method called range. The first parameter contains the number that you want to start with while the second parameter contains the number of the end point. For example, the value of x is 30. So if you want to end up with 30 in the second parameter, you should insert there 31.

after that if the number before the endpoint is divisible, then the following number/s are the factors of your chosen number.

1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s