Write a function named returnDivisors that accepts a positive integer n as the parameter, and returns a list containing all the divisors of n. Test your function in main. Let user enter an integer from keyboard (your program must be able to check the validation of the entered integer being positive), and then call returnDivisors function which should receive the entered integer as the argument. PYTHON
Answers
Answered by
0
function divisors(integer) {
var numb=[];
for (var x=2;x<integer;x++){
if(integer % x == 0){
numb.push(x);
}
}
if (integer%2!=0){
return (integer +' is'+' prime');
}
return numb;
}
Similar questions
English,
2 months ago
Computer Science,
2 months ago
Math,
2 months ago
Math,
4 months ago
English,
11 months ago
Computer Science,
11 months ago
English,
11 months ago