Thursday, February 20, 2014

Example of Dynamic initialization in C#.

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

namespace DynamicInitialization
{
    class Program
    {
        static void Main(string[] args)
        {
            double s1 = 5.5, s2 = 10.10;

            double hypot = Math.Sqrt((s1 * s1) + (s2 * s2));

            Console.Write("Hypotenuse of triangle with sides " +s1 + " by " + s2 + " is " + hypot);

            Console.ReadLine();
        }
    }
}

Output:

No comments:

Post a Comment