package arraythree1;
import java.util.Scanner;
public class ArrayThree1
{
public static void main(String[] args)
{
int i,j,k;
int[][][] threeD =new int [2][3][2];
Scanner input = new Scanner (System.in);
Scanner input2 =new Scanner(System.in);
int threeD2 [][][]=new int [2][3][2];
System.out.printf("\nEnter the three dimension array1\n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
threeD[i][j][k] = input.nextInt();
}
}
}
System.out.printf("Enter the three dimension array2\n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
threeD2[i][j][k] = input2.nextInt();
}
}
}
System.out.printf("Your Entered array is \n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
System.out.printf(" %d ",threeD[i][j][k]);
}
System.out.println();
}
System.out.println();
}
System.out.printf("The sum of 3D array is \n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
System.out.printf(" %d ", (threeD[i][j][k]* threeD2[i][j][k]) );
}
System.out.println();
}
System.out.println();
}
}
}
import java.util.Scanner;
public class ArrayThree1
{
public static void main(String[] args)
{
int i,j,k;
int[][][] threeD =new int [2][3][2];
Scanner input = new Scanner (System.in);
Scanner input2 =new Scanner(System.in);
int threeD2 [][][]=new int [2][3][2];
System.out.printf("\nEnter the three dimension array1\n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
threeD[i][j][k] = input.nextInt();
}
}
}
System.out.printf("Enter the three dimension array2\n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
threeD2[i][j][k] = input2.nextInt();
}
}
}
System.out.printf("Your Entered array is \n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
System.out.printf(" %d ",threeD[i][j][k]);
}
System.out.println();
}
System.out.println();
}
System.out.printf("The sum of 3D array is \n");
for(i=0; i<2; i++)
{
for(j=0; j<3; j++)
{
for (k=0; k<2; k++ )
{
System.out.printf(" %d ", (threeD[i][j][k]* threeD2[i][j][k]) );
}
System.out.println();
}
System.out.println();
}
}
}
No comments:
Write comments