Having a good previous year, Monk is back to teach algorithms and data structures. This year he welcomes the learners with a problem which he calls "Welcome Problem". The problem gives you two arrays A and B (each array of size N) and asks to print new array C such that:
;
Now, Monk will proceed further when you solve this one. So, go on and solve it :)
Input:
First line consists of an integer N, denoting the size of A and B.
Next line consists of N space separated integers denoting the array A.
Next line consists of N space separated integers denoting the array B.
Output:
Print N space separated integers denoting the array C.
Input Constraints:
;
;
SAMPLE INPUT
5 1 2 3 4 5 4 5 3 2 10
SAMPLE OUTPUT
5 7 6 6 15
Explanation
The output array is the addition of input arrays A and B.
Solution-
import java.util.*;
class Addtwo{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr[]=new int[n];
int brr[]=new int[n];
int crr[]=new int[n];
for(int i=0;i<n;i++)
{
arr[i]=sc.nextInt();
}
for(int i=0;i<n;i++)
{
brr[i]=sc.nextInt();
}
for(int i=0;i<n;i++)
{
crr[i]=arr[i]+brr[i];
}
for(int i=0;i<n;i++)
{
System.out.print(" "+crr[i]);
}
}
}