Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
int[] arr = {4, 6, 9, 12};
int sum = 0;
for(int i=0; i<arr.length; i++){
sum += arr[i];
}
for(int i=0; i<arr.length; i++){
System.out.print(arr[i] + " ");
}
System.out.println("");
System.out.println("The sum of the numbers: " + sum);
}
}
Explanation:
* The code is written in Java.
- Initialize the array with the given numbers
- Initialize the <em>sum</em> variable as zero
- Calculate the sum in the first for loop
- Print the numbers in the second for loop
- Print the <em>sum</em>
Decomposition will be used so you can break down the game into smaller and more manageable parts.
Answer:
Following is the code in python language
team_names = ('Rockets','Raptors','Warriors','Celtics')#holding the string value
print(team_names[0],team_names[1],team_names[2],team_names[3])#display
Output:
Rockets Raptors Warriors Celtics
Explanation:
Following is the description of above statement .
- Create a dictionary "team_names" that is holding the string value Rockets Raptors Warriors and Celtics.
- Finally we used the print function in that function we pass the index of corresponding dictionary i.e team_names[0] . it will display the first index value similarly we pass team_names[1], team_names[2] team_names[3].
Answer:
i no you its me remember and the answer is b.
Explanation: