1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
garri49 [273]
3 years ago
12

You do not need to use any functions beyond the main function in this problem. Initialize an array of int with the values: 4, 6,

9, and 12. Write a for loop to add the values in the array and find their sum. Write a second loop to print the values from the array and their sum in the following format: 4 6 9 12
Computers and Technology
1 answer:
zheka24 [161]3 years ago
4 0

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>

You might be interested in
Students are studying the effects of beach pollution by counting populations of seagulls at two different beach locations. One l
KIM [24]

Answer:

The number of seagulls in each location.

Explanation:

Dependent variables are something that you are recording or measuring.

7 0
3 years ago
The idea that an object can exist separate from the executing program that creates it is called
vaieri [72.5K]

Answer:

Explanation:

Apply handrub to palm of one hand.

Rub hands together covering all surfaces of hands and fingers.

Rub until handrub is absorbed.

3 0
3 years ago
Which of the following can a cell contain?
Ksju [112]
The answer is choice D-All of these :)
8 0
3 years ago
Read 2 more answers
Create a poem about MS powerpoint presentation
iren2701 [21]
You could use poem generator online or see samples and change some words
5 0
3 years ago
10^4+10-2=<br>10^4+10-2=
yaroslaw [1]
10008 is the answer to your question
4 0
3 years ago
Read 2 more answers
Other questions:
  • April 107 90 29 31 66 0.344
    8·1 answer
  • Which button, when pressed, allows light from the subject to fall on the sensor?
    8·1 answer
  • Why is it a good idea to leave an interview being courteous and polite?
    10·1 answer
  • JavaBeans are?A special Java classfileServletsAppletsA Special form of JSPNone of Given
    8·1 answer
  • To drive defensively means taking proactive measures to avoid accident situations regardless of their potential causes.
    6·2 answers
  • __________ are the first line of defense against unsafe drivers.
    5·1 answer
  • Drag the right word to it’s definition
    13·1 answer
  • Is spin to win paying or is a scam app​
    6·2 answers
  • ¿por que hay peligros en internet?
    11·1 answer
  • What is a disadvantage of communicating on social media?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!