Question from the Java - Fundamentals test

Write a Java program to calculate the sum of first 5 numbers

Easy
public class Example {
    public static void main(String[] args) {
        int[] numbers = {1, 2, 3, 4, 5};
        int sum = 0;
        for (int i = 0; i < numbers.length; i++) {
            sum += numbers[i];
        }
        System.out.println(sum);
    }
}

What will be the output of the following Java code?

Author: EL Mostafa FadiliStatus: PublishedQuestion passed 100 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!