using System;
using System.Windows.Forms;

namespace _6_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private struct Student
        {
            public string name;
            public double[] grades;
        }
        
        private void Form1_Load(object sender, EventArgs e)
        {
            listBox1.RightToLeft = RightToLeft.Yes;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Student[] st = new Student[4];
            //----------------------------------------
            st[0].name = "خشایار";
            st[0].grades = new double[4];
            st[0].grades[0] = 20;
            st[0].grades[1] = 15;
            st[0].grades[2] = 18;
            st[0].grades[3] = 17;
            //----------------------------------------
            st[1].name = "نصیر";
            st[1].grades = new double[4];
            st[1].grades[0] = 14;
            st[1].grades[1] = 19;
            st[1].grades[2] = 15;
            st[1].grades[3] = 20;
            //----------------------------------------
            st[2].name = "فرید";
            st[2].grades = new double[4];
            st[2].grades[0] = 16;
            st[2].grades[1] = 17;
            st[2].grades[2] = 20;
            st[2].grades[3] = 18;
            //----------------------------------------
            st[3].name = "پیمان";
            st[3].grades = new double[4];
            st[3].grades[0] = 13;
            st[3].grades[1] = 19;
            st[3].grades[2] = 20;
            st[3].grades[3] = 16;
            //----------------------------------------
            for (int i = 0; i < 4; i++)
            {
                double sum = 0;
                for (int j = 0; j < 4; j++)
                    sum += st[i].grades[j];
                listBox1.Items.Add(st[i].name + ": " + (sum / 4).ToString(".00"));
            }
        }
    }
}