find the surface area of a rectangular prism in csharp

To find the surface area of a rectangular prism in C#, you can use the formula:

main.cs
SA = 2lw + 2lh + 2wh
21 chars
2 lines

Where SA is the surface area, l is the length, w is the width, and h is the height of the rectangular prism.

Here's an example C# program that computes the surface area of a rectangular prism:

main.cs
using System;

class MainClass {
  public static void Main (string[] args) {
    double l = 5.0;
    double w = 3.0;
    double h = 2.0;

    double area = 2 * l * w + 2 * l * h + 2 * w * h;

    Console.WriteLine ("The surface area of the rectangular prism is {0}", area);
  }
}
280 chars
14 lines

In this example, we have a rectangular prism with length l of 5.0 units, width w of 3.0 units, and height h of 2.0 units. The program computes the surface area using the formula and prints the result to the console.

The output of the program is:

main.cs
The surface area of the rectangular prism is 62
48 chars
2 lines

gistlibby LogSnag