Question: IN PYTHON Question 1: Write a program that reads an integer from the user and then prints out the number of factors the integer has.

IN PYTHON

Question 1: Write a program that reads an integer from the user and then prints out the number of factors the integer has. For example, if the integer is 12 the output would be 6 since 12 divides by 1, 2, 3, 4, 6 and 12.

Question 2: Write a procedure/method that takes a positive integer parameter and prints the number that results from adding up the digits of the parameter. For example, if the parameter has the value 367, your procedure should print 16. Your procedure must not contain any input statements.

Question 3: Write a function/value-returning method that takes two integer parameters and returns the real value obtained by dividing the first parameter by the second parameter. If the second parameter is 0, your function should return 0.

Question 4: Write a program that creates a two-dimensional array with 500 elements, and fills the array with an alternating pattern of 0s and 1s.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!