Write a program in python, to print divisor of a given number
Steps:
- Ask User to enter a Number
- Use for loop over 1 to 100 to check divisor
- use if loop to find the correct number
Enter a number between 1 to 100 : Print divisor of number :96 1 is divisor of number 96 2 is divisor of number 96 3 is divisor of number 96 4 is divisor of number 96 6 is divisor of number 96 8 is divisor of number 96 12 is divisor of number 96 16 is divisor of number 96 24 is divisor of number 96 32 is divisor of number 96 48 is divisor of number 96 96 is divisor of number 96Second Method
Enter a number between 1 to 100 : Print divisor of number:96 The number has following divisors:[1, 2, 3, 4, 6, 8, 12,16, 24, 32, 48, 96]
0 Comments
If you have any doubt and suggestion Please let me know