Implementation of the "DAY3" 3*3*3 array

Source: Internet
Author: User

Class Multi3darray{public static void Main (string[] args) {int[][][] arr=new Int[3][3][3];arr (arr); Outarr (arr);}       public static int[][][] Arr (int[][][] arr) {int no=1;   for (int i=0;i<3;i+=1) {for (int. j=0;j<3;j+=1) {for (int k=0;k<3;k+=1) {arr[i][j][k]=no; no++;}}} return arr;}    public static void Outarr (int[][][] arr) {for (int. i=0;i<3;i+=1) {for (int. j=0;j<3;j+=1) {for (int k=0;k<3;k+=1) { System.out.print (arr[i][j][k]+ "");} System.out.println ();} System.out.println ("---------");}}

Two functions were created, arr () and Outarr (), respectively, to assign values to arrays and to print the values of an ordered array

This article is from the "Yehomlab" blog, make sure to keep this source http://yehom.blog.51cto.com/5159116/1772610

Implementation of the "DAY3" 3*3*3 array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.