Assignemnt #131 and Create Arrays
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Create Arrays
///File Name: CreateArrays
///Date Finished: 4/28/16
public class CreateArrays
{
public static void main(String[] args)
{
int[] intArray = {45, 9, 6, 36};
System.out.println("Here are some numbers " + intArray[0] + ", " + intArray[1] + ", " + intArray[2] + ", and " + intArray[3] + ".");
int add = intArray[1] + intArray[2];
int sub = intArray[0] - intArray[3];
int multi = intArray[1] * intArray[2];
int div = intArray[3] / intArray[2];
System.out.println("We can add them " + intArray[1] + " + " + intArray[2] + " = " + add);
System.out.println("We can subtract them " + intArray[0] + " - " + intArray[3] + " = " + sub);
System.out.println("We can add them " + intArray[1] + " * " + intArray[2] + " = " + multi);
System.out.println("We can add them " + intArray[3] + " / " + intArray[2] + " = " + div);
}
}
Picture of the output