GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaArrays/SumArray.md at main · AlexaJavaDev/JavaArrays

Expand file tree

/

SumArray.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
22 lines (19 loc) · 431 Bytes
/

SumArray.md

Copy path

File metadata and controls

22 lines (19 loc) · 431 Bytes
Raw
Copy raw file
Download raw file
Edit and raw actions

Что делает:
Считает сумму всех элементов массива.

Код:

public class SumArray {
    public static void main(String[] args) {
        int[] a = {5, 12, 8, 21, 3};
        int sum = 0;

        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        System.out.println(sum);
    }
}

Пример вывода в консоли:

49
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.