subject

Write a function called factors of number that takes as input a positive integer and returns the factors of the positive integer as an array. for example, if the integer is 6, the output is an array consisting of the values [1 2 3 6]. test your function on the following numbers: 26, 64, 97 and 187
1 and the number itself are always factors.
2. to find other factors, check up to the floor of the squareroot of the number. for example, if the number is 10, floor (squareroot 10) = 3.
a. 10 mod 2 equals 0. that means 2 and 5 (which is 10/2) are factors. in this case, it is ok to dynamically grow your array.
b. 10 mod 3 equals 1, which means 3 is not a factor. since we check up to 3, this completes the function and we return [1 10 2 5] as the factors of 10 (order is not important).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
Jenna updated her status on a social network regarding her upcoming vacation. what information should jenna not provide when updating her status on a social networking site? a. her favorite quote b. her likes in popular culture c. her routine d. her opinions on social issues res
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Michael has written an e-mail to his employees that describes a new product special that will be introduced to the customers next week. by taking time to make sure the e-mail is well written, logical, and organized, michael has made sure his message has the characteristics of a) effective communicationb) ineffective communicationc) barriers to communicationd) workplace communication
Answers: 2
You know the right answer?
Write a function called factors of number that takes as input a positive integer and returns the fac...
Questions
question
Social Studies, 15.07.2019 08:30
question
Biology, 15.07.2019 08:30
Questions on the website: 13722367