Что делает:
Считает сумму всех элементов массива.
Код:
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
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
| 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. |