Wednesday, 27 November 2013

C# Structure Volume Of Cuboid Program------|||||||

Code:

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

namespace StructureVolumeOfcuboid
{
  public  class Program
    {

       
              struct Cuboid
        {
            int length;
            int breadth;
            int height;

            Cuboid(int x, int y,int z)
            {
                length = x;
                breadth = y;
                height = z;
            }
          int Volume()
            {
               return length * breadth*height;
}

            public static void Main(string[] args)
            {
                Cuboid vol= new Cuboid(10,20,30);
                Console.WriteLine("\n Volume of Cubid is"+"="+vol.Volume());



             
                Console.ReadKey();
            }
        }
    }
}

Output:


3 comments:

  1. Thanks for the program. How do I determine other parameters like surface area of the cuboid? And how do I allow for the inputs like the length, width and height to be determined by the user of the program. Thanks.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. http://dotnetadherents.blogspot.in/search?updated-min=2015-01-01T00:00:00-08:00&updated-max=2016-01-01T00:00:00-08:00&max-results=1

    ReplyDelete