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

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

        private void button1_Click(object sender, EventArgs e)
        {
            label2 .Text = "Result : ";
            int num = Convert.ToInt32(textBox1.Text);
            bool isPrime = true ;
            int i;
            for (i = 2; i <= (num / 2) && isPrime ; i++)
                if(num % i == 0)
                   isPrime = false;
            if (isPrime)
                label2.Text += "Number " + num.ToString() + " is prime";
            else
                label2.Text += "Number " + num.ToString() + " is not prime";

        }
    }
}
