Question: Please solve this code in MATLAB as soon as possible Programming Assignment (6 CSCI 251 Due Date: Nov 29, 2018 before 11:59pm A positive integer

Please solve this code in MATLAB as soon as possiblePlease solve this code in MATLAB as soon as possible Programming Assignment(6 CSCI 251 Due Date: Nov 29, 2018 before 11:59pm A positiveinteger is called a perfect number if it is equal to thesum of all of its positive divisors, excluding itself. For example, 6

Programming Assignment (6 CSCI 251 Due Date: Nov 29, 2018 before 11:59pm A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number because 6 = 3 + 2 + 1" The next is 28 = 14 + 7 +4+2+1. As an example there are four perfect numbers less than 10,000. For program 6, write a program that prompts for a number. Find all of the perfect numbers less than or equal to that number. Program Requirements You must implement this program using a function. The function will have 2 return values: a boolean (true or false) and an array. Function: 1. 2. The function should have 1 parameter (the number) and 2 return values (a Boolean (true or false) and an array) Within the function body, use a modification of the greatest common divisor (ged) code. Build an array that finds all of the divisors, including 1, not just the gcd. a. b. The for-loop building the array of divisors should begin at the (number 1). Recall that a perfect number does not include itself in the sum. Step down to 1 Also, the easiest way to determine if you have a divisor is to use modulus (ie mod(number, 1)) Determine if the sum of the divisors is equal by stepping through the array you just built. If they are equal, it is a perfect number so return true, otherwise return false. In both cases, you will return the array. c. Programming Assignment (6 CSCI 251 Due Date: Nov 29, 2018 before 11:59pm A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number because 6 = 3 + 2 + 1" The next is 28 = 14 + 7 +4+2+1. As an example there are four perfect numbers less than 10,000. For program 6, write a program that prompts for a number. Find all of the perfect numbers less than or equal to that number. Program Requirements You must implement this program using a function. The function will have 2 return values: a boolean (true or false) and an array. Function: 1. 2. The function should have 1 parameter (the number) and 2 return values (a Boolean (true or false) and an array) Within the function body, use a modification of the greatest common divisor (ged) code. Build an array that finds all of the divisors, including 1, not just the gcd. a. b. The for-loop building the array of divisors should begin at the (number 1). Recall that a perfect number does not include itself in the sum. Step down to 1 Also, the easiest way to determine if you have a divisor is to use modulus (ie mod(number, 1)) Determine if the sum of the divisors is equal by stepping through the array you just built. If they are equal, it is a perfect number so return true, otherwise return false. In both cases, you will return the array. c

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!