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

        int puissance(int nb, int p)
        {
            int i, resultat;
            resultat = 1;
            for (i = 1; i <= p; i=i+1)
            {
                resultat = resultat * nb;
            }
            return (resultat);
        }

        private void btn0_Click(object sender, EventArgs e)
        {
            int nbresult;
            nbresult = puissance(2, 4);
            lblaff0.Text = Convert.ToString(nbresult);
        }

        private void btn1_Click(object sender, EventArgs e)
        {
            int nbresult;
            nbresult=puissance(2, 8);
            lblaff1.Text= Convert.ToString(nbresult);
        }

        private void btn2_Click(object sender, EventArgs e)
        {
            int nbresult;
            nbresult = puissance(2, 16);
            lblaff2.Text = Convert.ToString(nbresult);
        }

        private void btn3_Click(object sender, EventArgs e)
        {
            int nbresult;
            int nbp3;
            nbp3 = Convert.ToInt32(txtp3.Text);
            nbresult = puissance(2, nbp3);
            lblaff3.Text = Convert.ToString(nbresult);
        }

        private void btn4_Click(object sender, EventArgs e)
        {
            int nbresult;
            int nbp3;
            int nbp4;
            nbp3 = Convert.ToInt32(txtp4.Text);
            nbp4 = Convert.ToInt32(txtnb4.Text);
            nbresult = puissance(nbp4, nbp3);
            lblaff4.Text = Convert.ToString(nbresult);
        }


    }
}
