Sum assignment finished

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Arrays; class Main { public static void main(String[] args) { System.out.println("53 55 4D 41 53 53 49 47 4E 4D 45 4E 54 \t <<<You should now what this says right? \n"); int[] Array = new int[10]; //sets the array to go up to the # 10 for(int i=0;i<Array.length; i++){ //makes it so that the array prints out random numbers int randomNumber = (int)Math.round(Math.random()*10); Array[i] = randomNumber; } int evenTotal=0, oddTotal=0; int target=3; int[] copy = new int[Array.length - 1]; for (int i = 0, j = 0; i < Array.length; i++) { if (i != target) { copy[j++] = Array[i]; } } System.out.println("Original set" + Arrays.toString(Array)+"\n");//original System.out.println("Modified set" + Arrays.toString(copy)+"\n"); //modified //print all even numbers for(int i=0; i<copy.length; i++){ if(copy[i]%2 == 0){ evenTotal+=copy[i]; System.out.print(" "+copy[i]); } } System.out.println(" = "+ evenTotal+"< Even total"+"\n"); //print all odd numbers for(int i=0; i<Array.length; i++){ if(Array[i]%2 != 0){ oddTotal+=Array[i]; System.out.print(" "+Array[i]); } } System.out.println(" = "+oddTotal+"< Odd total"); } }
Editor Settings
Theme
Key bindings
Full width
Lines