– int[] exponent = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int[] powers = new int[10];
for (int i = 0; int < 10; i++){
power [i] = math.pow(2, exponent[i])
} ;
February 25, 2008
rita1012
1. Parallel arrays can be achieved by using two arrays in which corresponding elements are related.2. In this example, the parallel arrays are both full and the loops use the instance variable length. 3. String [] name = new String[50]int [] age = new int [50]int [] security = new int [50]String searchPerson;int correspondingAge = -1, correspondingSecurity = -1searchName = …for (int i = 0, i<name.length; i ++) if (searchName.equal (name[i]))correspondingAge = age [i]correpondingSecurity = security [i]break;}4.5. array should contain the exponent and the other array should contain 2 raised to that power.
– int[] exponent = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int[] powers = new int[10]; for (int i = 0; int < 10; i++){ power [i] = math.pow(2, exponent[i]) } ;
Entry Filed under: Uncategorized
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to comments via RSS Feed
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | Apr » | |||||
| 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 | 29 | ||
Theme: Sweet Blossoms by TalkXHTML.
Blog at WordPress.com.