예제 #1
0
 public int Jami(Klasi4 masivi1)
 {
     foreach (int element in masivi)
     {
         if (element % 2 == 0)
         {
             jami += element;
         }
     }
     return(jami);
 }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            int[] arg1 = new int[] { 10, 20, 30, 25, 999 };
            int[] arg2 = new int[] { 30, 20, 30, 25, 999 };
            int[] arg3 = new int[] { 50, 20, 30, 25, 999 };

            Klasi4 obieqti1 = new Klasi4(arg1);
            Klasi4 obieqti2 = new Klasi4(arg2);
            Klasi4 obieqti3 = new Klasi4(arg3);

            label1.Text = obieqti1.Jami(obieqti1).ToString();
            label2.Text = obieqti1.Jami(obieqti2).ToString();
            label3.Text = obieqti2.Jami(obieqti1).ToString();
        }