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 _4._1._0._0._0 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public double Facto(double a) { double factorial = a; progressBar1.Maximum = Convert.ToInt32(a); progressBar1.Increment(1); while (a != 1) { factorial = factorial * (a - 1); a--; progressBar1.Increment(1); } return factorial; } private void button1_Click(object sender, EventArgs e) { string a = textBox1.Text.ToString(); double result = Facto(double.Parse(a)); a = result.ToString(); textBox2.Text = (a); } private void label1_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void progressBar1_Click(object sender, EventArgs e) { } } }