using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        long sum(int[] a)
        {
            long s = 0;
            foreach (int x in a)
            {
                s += x;
            }
            return (s);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //int[] n = { 10, 6, 5, 2, 1,1 };
            //MessageBox.Show(sum(n).ToString());
            int[][] n = new int[3][];
            n[0] = new int[] { 1, 2, 3, 4 };
            n[1] = new int[2];
            n[2] = new int[] { 5, 3, 4 };
            //jagged
            for (int i = 0; i <= 2; i++)
                foreach (int item in n[i])
                {
                    listBox1.Items.Add(item.ToString());
                }
        }
            ////int[,] n= new int[3,4];
            //int[,] n = { { 10, 6, 5, 2, 1 }, { 7, 1, 2, 4, 5 } };// ;
            ////int[] n = new int[int.Parse(textBox1.Text)];
            ////Array.Sort(n);
            ////Array.Reverse(n);
            ////listBox1.Items.Clear();
            //for (int j = n.GetLowerBound(0); j <= n.GetUpperBound(0); j++)
            //{
            //    for (int i = n.GetLowerBound(1); i <= n.GetUpperBound(1); i++)
            //    {
            //        listBox1.Items.Add(n[j, i].ToString());
            //    }
            //}
            //int[][] n = new int[3][];
            //n[0] = new int[] { 1, 2, 3, 4 };
            //n[1] = new int[2];
            //n[2] = new int[] { 5, 3, 4 };
            ////jagged
            //for (int i = 0; i <= 2; i++)
            //{
            //    listBox1.Items.Add(n[i][2].ToString());
            //}
            //string[] n = textBox1.Text.Split(',');
            //listBox1.Items.Clear();
            //for (int i = 0; i <n.Length ; i++)
            //{
            //    listBox1.Items.Add(n[i].ToString());
            //}
        
    }
}
