Skip to content

Instantly share code, notes, and snippets.

@PocasPedro
Created October 23, 2017 17:19
Show Gist options
  • Save PocasPedro/f1f4a77402a213400e9cc9f703da8dad to your computer and use it in GitHub Desktop.
Save PocasPedro/f1f4a77402a213400e9cc9f703da8dad to your computer and use it in GitHub Desktop.
Java Fundamentals for Kids - Exercise 15
public class SumArray {
public static void main(String[] args) {
//Define & Initialization
int mumbers[] = new int[] {196,10,6,40,44};
int sum = 0;
for(int i = 0 ; i <= 4 ; i ++){
sum = sum + mumbers[i];
}
System.out.println("The sum of the numbers array is: " + sum);
}
}
@jabrena
Copy link

jabrena commented Oct 23, 2017

public class SumArray {

public static void main(String[] args) {

    //Define & Initialization
    int mumbers[] = new int[] {196,10,6,40,44};
	
	int sum = 0;
	
	for(int i = 0 ; i <= 4 ; i ++){
		sum += mumbers[i];
	}
	
	System.out.println("The sum of the numbers array is: " + sum);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment