Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int arr[][]=new int[3][5];
- System.out.println("please enter 5 numbr to arr #1 plus 5 to arr #2");
- for(int i=0; i<2; i++) // receiving data from user
- {
- for (int y = 0; y < 5; y++) {
- arr[i][y] = s.nextInt(); // entering data into arrays
- }
- }
- for(int i=0;i<5;i++)
- {
- arr[2][i]=arr[0][i]+ arr[1][i];// sum of arrays 1 and 2 to third array
- System.out.printf("%d \n",arr[2][i]);//printf the third array
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement