import java.util.Scanner;
public class ThreeDArray
{
public static void main(String []args)
{
Scanner s=new Scanner(System.in);
System.out.println("Enter number of Pages:");
int p=s.nextInt();
System.out.println("Enter number of rows:");
int r=s.nextInt();
System.out.println("Enter number of colums:");
int c=s.nextInt();
int arr[][][]=new int[p][r][c];
System.out.println("Enter numbers in Three dimentional Array:");
for(int j=0;j<arr.length;j++)
for(int i=0;i<arr.length;i++)
for(int k=0;k<arr.length;k++)
{
arr[i][j][k]=s.nextInt();
}
System.out.println("printing");
for(int j=0;j<arr.length;j++)
for(int i=0;i<arr.length;i++)
for(int k=0;k<arr.length;k++)
{
System.out.println(arr[i][j][k]);
}
}
}
0 comments:
Post a Comment