find area of a cube in csharp

To find the surface area of a cube in C#, you would need to use the following formula:

main.cs
surfaceArea = 6 * (side * side)
32 chars
2 lines

where side is the length of one side of the cube.

Here is a sample C# code that takes user input for the side length and calculates the surface area of the cube:

main.cs
using System;

class Program {
    static void Main(string[] args) {
        double side, surfaceArea;

        Console.WriteLine("Enter the length of one side of the cube: ");
        side = double.Parse(Console.ReadLine());

        surfaceArea = 6 * (side * side);

        Console.WriteLine("The surface area of the cube is: " + surfaceArea);
    }
}
355 chars
15 lines

gistlibby LogSnag