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_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label2.Visible = true;
            label2.Text = " Result is : ";
            int num;
            num = Convert.ToInt32(textBox1.Text);
            if (num % 2 == 0)
                label2.Text += "Smallest factor of " + num.ToString() + " is " + 2;
            else if (num % 3 ==0)
                label2.Text += "Smallest factor of " + num.ToString() + " is " + 3;
            else if (num % 5 == 0)
                label2.Text += "Smallest factor of " + num.ToString() + " is " + 5;
            else if (num % 7 == 0)
                label2.Text += "Smallest factor of " + num.ToString() + " is " + 7;
            else
                label2.Text += num.ToString() + " is not divisible by 2, 3, 5, 7";

        }
    }
}
