private void btnMass2_Click(object sender, RoutedEventArgs e) { bool est = false; int positiveCount = 0; int negativeCount = 0; for (int i = 0; i < 4; i++) { positiveCount = 0; negativeCount = 0; for (int j = 0; j < 4; j++) { if (mass2[i, j] > 0) { positiveCount++; } if (mass2[i, j] < 0) { negativeCount++; } } if (positiveCount == negativeCount) { est = true; break; } } MassOut2.AppendText("\n \n" + est.ToString()); }
public Page4() { InitializeComponent(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { mass2[i, j] = random.Next(-10, 10); MassOut2.AppendText(mass2[i, j].ToString() + " | "); } MassOut2.AppendText(" \n "); } for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { mass3[i, j] = i + 1; if (i >= 2 && j == 5) { mass3[i, j] = 0; } if (i >= 3) { if (j > 1) { mass3[i, j] = 0; } } if (i == 5) { mass3[i, j] = 0; mass3[i, 0] = 6; } MassOut3.AppendText(mass3[i, j].ToString() + " | "); } MassOut3.AppendText(" \n "); } for (int i = 0; i < 5; i++) { for (int j = 0; j < 8; j++) { mass4[i, j] = random.Next(-10, 10); MassOut4.AppendText(mass4[i, j].ToString() + " | "); } MassOut4.AppendText(" \n "); } }