Professional Documents
Culture Documents
Output:: Args Scan Size Scan Array1 Size Array2 Size Result Size
Output:: Args Scan Size Scan Array1 Size Array2 Size Result Size
Scanner;
public class ArrayAddition
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter the size of the two arrays");
int size = scan.nextInt();
int [] array1 = new int[size];
int [] array2 = new int[size];
int [] result = new int[size];
Output:
Enter the size of the two arrays
5
Enter the elements of array 1
10
20
30
0
0
Enter the elements of array 2
20
50
30
70
80
Sum of elements of array1 and array2
30 70 60 70 80