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
Which sparkline type is best for displaying trends in data changes over time?
Ratling [72]
I would say line Sparkline type helps display trends over time
5 0
3 years ago
Charlie makes pizza at a restaurant. The customers always compliment how great the pizza tastes. But Charlie takes a long time t
Oksi-84 [34.3K]
To get this u must do 8372928+(2728279298)=382627-6382638)()()(7372637 I did it right I’m the test
8 0
3 years ago
Read 2 more answers
Life without internet points
Lady_Fox [76]
You have to ask a question to get an answer
7 0
3 years ago
Read 2 more answers
Difference between ancient and modern mode of information <br> transmission
ELEN [110]
Ancient mode of transmission are used by people in the past while modern mode of transmission are used by present people
4 0
3 years ago
Which are technical and visual demands that need to be considered when planning a project? Choose three answers
Marina CMI [18]

Answer: Resolution or DPI, deliverables, and file types are important technical and visual demands to consider when planning a project.

Explanation: Keep in mind whether or not the project will be published in print or on the Web.

8 0
3 years ago
Other questions:
  • When doing a complex presentation, which of the following would be the best tool to begin designing your presentation?
    11·2 answers
  • Knowing the meaning of the acronym WYSIWYG can be most helpful to you when you
    14·1 answer
  • Which is an example of static web page??
    9·2 answers
  • Florida Highway Safety and Motor Vehicles reported blank of traffic fatalities were alcohol-related in Florida in 2009.​
    8·1 answer
  • Why computer is known as data processing system?
    14·1 answer
  • What is one of the first power tools you’ll need as electrician
    15·1 answer
  • Explain how the operating system controls the software and hardware on the computer?
    5·1 answer
  • Which of the following techniques is a direct benefit of using Design Patterns? Please choose all that apply Design patterns hel
    12·1 answer
  • One of the benefits of holding an investment for over a year rather than selling it in less than a year is that the
    14·2 answers
  • When you create a new database using --------- , the database includes prebuilt tables and forms which you can populate with dat
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!