C# Form Projeleri 86 – Factorial Calculation Uygulaması v1.0

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

        private void BtnFactorial_Click(object sender, EventArgs e)
        {
            long Factorial = 1, N = 0;

            N = Convert.ToInt64(TextValue.Text);

            if (N==0 || N==1)
            {
                Factorial = 1;
            }

            else if (N>1)
            {
                for (int i = 1; i <= N; i++)
                {
                    Factorial *= i;
                }
            }

            else
            {
                MessageBox.Show("Can Not Enter Negative Value or Character Set!!!");
            }

            LblResult.Text = N + "!=";
            TextResult.Text = Factorial.ToString();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

 

Proje Dosyasını Github Hesabımdan İndirebilirsiniz


muratbilginer