0318 다차원 배열 연습 10개

2021. 3. 18. 16:15C#/수업내용

풀 = 100

모래 = 101

물=300

public class App
    {
        public App()
        {
            Console.WriteLine("App");
            int[,] arr ={
                { 101, 100, 100 },
                { 101, 101, 101 },
                { 100, 100, 100 },
                };

            Console.WriteLine(arr.GetLength(0));
            Console.WriteLine(arr.GetLength(1));

            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0, 2} ",arr[i,j]);
                }
                Console.WriteLine();
            }
        }   
    }

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr ={
                { 100, 300, 301 },
                { 100, 100, 302 },
                { 101, 100, 100 },
                };

            Console.WriteLine(arr.GetLength(0));
            Console.WriteLine(arr.GetLength(1));

            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0, 2} ",arr[i,j]);
                }
                Console.WriteLine();
            }
        } 

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                {100,100,100,302,300 },
                {101,101,100,100,302 },
                {100,101,101,101,101 },
            };

            Console.WriteLine(arr.GetLength(0));
            Console.WriteLine(arr.GetLength(1));

            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0, 2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        } 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                {100,100,301 },
                {100,302,303 },
                {100,306,304 },
                {307,305,100 },
                {100,100,100 },
                {101,101,100 },
            };

            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }   

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 301, 302, 100, 100
                },
                { 101, 101, 100, 101
                },
                { 100, 101, 101, 101
                },
                { 101, 101, 101, 101
                },
            };

            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 100,100,303,302 },
                { 100,100,304,301 },
                { 307,306,305,100 },
                { 101,100,100,100 },
                { 308,101,101,100 },
                { 301,100,101,101 },
                { 100,100,100,100 }
            };
            for (int i=0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 301,302,304,305,100 },
                { 100,303,306,307,308 },
                { 100,100,303,309,100 },
                { 101,101,101,101,100 },
                { 100,100,100,101,101 },
                { 100,100,101,101,101 },
            };
            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 101,101,100,301,306,307,100 },
                { 100,101,101,101,100,100,100 },
                { 100,100,304,305,101,101,100 },
                { 100,301,302,303,100,101,101 },
            };

            for (int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 100,101,101,100,100,100,100,101,101,101 },
                { 101,101,100,100,100,100,100,100,301,302 },
                { 101,100,100,100,100,100,100,305,306,307 },
                { 301,303,304,302,100,100,100,100,100,100 },
            };
            
            for(int i = 0; i < arr.GetLength(0); i++) 
            {
                for (int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }

 

 

public App()
        {
            Console.WriteLine("App");
            int[,] arr = {
                { 100,101,101,100,100,100,100,100 },
                { 311,100,101,100,100,100,100,100 },
                { 100,100,101,100,100,100,100,310 },
                { 100,101,101,100,100,100,303,309 },
                { 101,101,100,100,100,100,308,302 },
                { 101,101,101,100,301,306,307,100 },
                { 100,100,101,101,101,100,100,100 },
                { 100,100,100,303,305,101,101,100 },
                { 100,100,301,304,302,100,101,101 },
            };
            
            for(int i = 0; i < arr.GetLength(0); i++) 
            {
                for(int j = 0; j < arr.GetLength(1); j++) 
                {
                    Console.Write("{0,2} ", arr[i, j]);
                }
                Console.WriteLine();
            }
        }