package comp1110.exam;
* COMP1110 Exam, Question 1.1
public class Q1Factors {
Copyright By PowCoder代写 加微信 powcoder
* This function takes a positive integer, n, and returns an array
* of ints containing all prime factors of that integer in ascending order.
* For example:
* factors(6) returns {2, 3}
* factors{7} returns {7}
* factors{24} returns {2, 2, 2, 3}
* If n is less than 2, an empty array is returned.
* @param n the number to factor
* @return an array containing all prime factors of the number
public static int[] factors(int n) {
// FIXME complete this method
return null;
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com