Final answer:
To write a program that adds the values of an integer array containing the first five odd numbers, declare the array, iterate through it to compute the sum, and store the result in a variable named sum without directly adding the numbers.
Step-by-step explanation:
To add the values of an integer array in a program, you'd typically follow this process. First, declare an array with the specific values, then use a loop to iterate through each element of the array, adding its value to a sum variable.
Example Code in Java:
int[] oddNumbers = {1, 3, 5, 7, 9};
int sum = 0;
for(int number : oddNumbers) {
sum += number;
}
System.out.println("The sum is " + sum);
This program creates an array oddNumbers with the first five odd numbers. A for-each loop is then used to go through the array and add each number to the sum variable. Finally, it prints out the sum.