Python @ DjangoSpin

PyPro #87 Factors of a number

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Factors of a number in Python

Factors of a number in Python

Write a Python program to list out all factors of a number.

givenNumber = 27

for number in range(1, givenNumber + 1):
	if givenNumber % number == 0:
		print(number)
	
## 1
## 3
## 9
## 27

See also:

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply