Mathematical Formula in c- sahrp language

Unique Code of Mathematical  Formula of Addition, Subtraction, Multiplication, Division,  Rectangular Square, Energy, Triangle, and Cylender (Belan).

Unique code of mathematical Formula, Formula of add, sub, multiply, division in C#
Dear Friends, I am Very Happy that you are visiting my site and learn Something form it. I Want to tell you some Unique Coding of Creating Some Mathematical Formula using Visual Studio 2005. I give here C# coding for it.
There for Simple Open The Visual Studio 2005 or 2008 and create a new Console application give the name as you wish. and Write the Following Code as given below. It must run your computer and work properly. So Try once and comment on this post.
Wish you all the best.!!!!!!

using System;
using System.Collections.Generic;
using System.Text;


namespace Area
{
    class Program
    {
        double Length, Width, Hight, Edge, Number1, Number2, Side, Base, Radius,Mass1,Mass2,velocity,Accelaration, Result;
        public void Add()
        {
            Console.WriteLine("Enter the First Number:");
            Number1 = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter the Second Number:");
            Number2 = Convert.ToDouble(Console.ReadLine());
            Result = Number1 + Number2;

            Console.WriteLine("The result is:{0}", Result);
        }

        public void Subtraction()
        {
            Console.WriteLine("Enter the First Number:");
            Number1 = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter the Second Number:");
            Number2 = Convert.ToDouble(Console.ReadLine());
            Result = Number1 - Number2;

            Console.WriteLine("The result is:{0}", Result);
        }
        public void Energy()
        {
            Console.WriteLine("Enter  the mass:");
            Mass1 = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter Accelaration:");
            Accelaration = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter The Hight:");
            Hight = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter the Velocity:");
            velocity = Convert.ToDouble(Console.ReadLine());
            Result = Mass1 * (Accelaration * Hight + ((velocity * velocity) / 2));
            Console.WriteLine("The Result Of Energy is:{0} jule", Result);
        }

        public void Rectangle()
        {
            Console.WriteLine("Enter the  Length:");
            Length = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter the Width:");
            Width = Convert.ToDouble(Console.ReadLine());
            Result = Length * Width;

            Console.WriteLine("The result is:{0}", Result);
        }
        public void Squire()
        {
            Console.WriteLine("Enter the Side of Squire:");
            Side = Convert.ToDouble(Console.ReadLine());


            Result = Side * Side;

            Console.WriteLine("The result is:{0}", Result);
        }

        public void Tringle()
        {
            Console.WriteLine("Enter the Base:");
            Base = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter the Hight:");
            Hight = Convert.ToDouble(Console.ReadLine());
            Result = 0.5 * Hight * Base;

            Console.WriteLine("The result is:{0}", Result);
        }
        public void AreaBelan()
        {
            Console.WriteLine("Enter Radius:");
            Radius = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("Enter The Hight:");
            Hight = Convert.ToDouble(Console.ReadLine());
            Result = (3.14 * Radius * Radius) + 6.28 * Radius * Hight;
            Console.WriteLine("The result is :{0}", Result);
        }

        static void Main(string[] args)
        {
            int option;
            Console.WriteLine("Enter your choice:");
            Console.WriteLine("1. Add two Numbers:");
            Console.WriteLine("2. Subtraction of Two Numbers:");
            Console.WriteLine("3. Area of Rectangular:");
            Console.WriteLine("4. Area of Squire:");
            Console.WriteLine("5. Area of Tringle:");
            Console.WriteLine("6. Area of Belan:");
            Console.WriteLine("7. Energy");
            Console.WriteLine("Your choice is printed Below:");
            option = Convert.ToInt32(Console.ReadLine());
            // Console.WriteLine("Your enter option is invalid:");

            Program pd = new Program();
            switch (option)
            {
                case 1:
                    pd.Add();
                    break;
                case 2:
                    pd.Subtraction();
                    break;
                case 3:
                    pd.Rectangle();
                    break;
                case 4:
                    pd.Squire();
                    break;
                case 5:
                    pd.Tringle();
                    break;
                case 6:
                   
                    pd.AreaBelan();
                    break;
                case 7:
                    pd.Energy();
                    break;
                default:
                    break;


            }


            Console.ReadLine();
        }
    }
}



Now  Press the F5 Button to run this program.
Comment must plz.
Enjoy this nice coding, Thanks a lots to visit my site.

You can see here A nice Coding of Digital Calculator also.

No comments: