Calculate the area of a circle, rectangle, triangle

Source: Internet
Author: User

Class Progarm

{

static void Main (string[] argm)

{

Console.WriteLine ("Select to shape (enter the graphics serial number)");

Console.WriteLine ("1, Circle, 2, Rectangle, 3, triangle);

String str = Console.ReadLine ();

Switch (STR)

{

Case "1":

Console.WriteLine ("Please enter the radius of the Circle:");

int r = Int. Parse (Console.ReadLine ());

int YS = MG (R);

Console.WriteLine ("Round Area ={0}", YS);

Break

Case "2":

Console.WriteLine ("Please enter the length of the rectangle:");

int c = Int. Parse (Console.ReadLine ());

Console.WriteLine ("Please enter the width of the rectangle:");

int k = Int. Parse (Console.ReadLine ());

int JS = MG (c, k);

Console.WriteLine ("Area of Rectangle ={0}", JS);

Break

Case "3":

Console.WriteLine ("Please enter the base length of the triangle:");

int d = Int. Parse (Console.ReadLine ());

Console.WriteLine ("Please enter the height of the triangle:");

int g = Int. Parse (Console.ReadLine ());

int x = 2;

int SS = MG (d, G, X);

Comsole.writeline ("Area of Triangle ={0}", SS);

Break

}

}

static int MG (int r)

{

return Math.PI * R * r;

}

static int MG (int chang, int kuan)

{

Return Chang * KUAN;

}

static int MG (int di, int gao, int x)

{

return di * gao/x;

}

}

Calculate the area of a circle, rectangle, triangle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.