Facebook
From Filip Wicha, 5 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 284
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace _4._1._0._0._0
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.        
  20.         public double Facto(double a)
  21.         {
  22.             double factorial = a;
  23.             progressBar1.Maximum = Convert.ToInt32(a);
  24.             progressBar1.Increment(1);
  25.             while (a != 1)
  26.             {
  27.                 factorial = factorial * (a - 1);
  28.                 a--;
  29.                 progressBar1.Increment(1);
  30.             }
  31.  
  32.             return factorial;
  33.         }
  34.  
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {
  37.             string a = textBox1.Text.ToString();
  38.             double result = Facto(double.Parse(a));
  39.             a = result.ToString();
  40.             textBox2.Text = (a);
  41.         }
  42.  
  43.         private void label1_Click(object sender, EventArgs e)
  44.         {
  45.  
  46.         }
  47.  
  48.         private void textBox1_TextChanged(object sender, EventArgs e)
  49.         {
  50.            
  51.         }
  52.  
  53.         private void textBox2_TextChanged(object sender, EventArgs e)
  54.         {
  55.  
  56.         }
  57.  
  58.         private void progressBar1_Click(object sender, EventArgs e)
  59.         {
  60.  
  61.         }
  62.     }
  63. }
  64.