-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChallengeOne.java
More file actions
28 lines (23 loc) · 892 Bytes
/
ChallengeOne.java
File metadata and controls
28 lines (23 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class ChallengeOne {
public static int[] odds(int numOdds) {
/**
* Return an array of the first numOdds odd numbers
* Arguments
* numOdds - a positive integer representing the number of odd numbers to store in the array
* Examples
* odds(3) returns [1, 3, 5]
*/
// ====================================
// Do not change the code before this
// CODE1: Write code that will create an array with the first numOdds
// odd numbers and return the array
// ====================================
// Do not change the code after this
}
public static void main(String[] args) {
int[] theOdds = odds(3);
// Expected output is
// 1, 3, 5
System.out.println(theOdds[0] + ", " + theOdds[1] + ", " + theOdds[2]);
}
}