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{ private Random random;public Form1(){InitializeComponent();random = new Random(); }private void goCmd_Click(object sender, EventArgs e){this.colours();}private void colours(){while (true){int number = random.Next();if ((number == 0) || (number == 5) || (number == 9)){label1.BackColor = Color.Red;label2.BackColor = Color.Blue;label3.BackColor = Color.Yellow;label4.BackColor = Color.Green;label5.BackColor = Color.Chocolate;label6.BackColor = Color.PaleGreen;}if ((number == 2) || (number == 6) || (number == 4)){label2.BackColor = Color.Red;label3.BackColor = Color.Blue;label4.BackColor = Color.Yellow;label5.BackColor = Color.Green;label6.BackColor = Color.Chocolate;label1.BackColor = Color.PaleGreen;}else{label3.BackColor = Color.Red;label4.BackColor = Color.Blue;label5.BackColor = Color.Yellow;label6.BackColor = Color.Green;label1.BackColor = Color.Chocolate;label2.BackColor = Color.PaleGreen;}}} }}