Perimeter and area

Source: Internet
Author: User
Tags define function

////Copyright (c) Level 2013 software 1 classes/all rithts reserved.//A36 Huanghade//Completion Date: December 9, 2013//// Problem Description: Create a program to find the perimeter and area of the rectangle//output: output perimeter and area//using system;using system.collections.generic;using system.linq;using System.text;using System.threading.tasks;namespace consoleapplication4{class Program {static void Main (Stri Ng[] args) {Rectangle rect1 = new Rectangle ();//Create Object rect1.width=12;//reference class member Rect1            . height=15; Console.Write ("area: {0}\n", rect1. Area ());//reference function area Console.Write ("perimeter: {0}\n", rect1.            Perimeter ());//reference function Perimeter Console.readkey ();//Freeze} class Rectangle//define class Rectangle {        Defines a class function member public int height;        public int width;  public int area ()//define function area {return width* height;//processing} public int Perimeter ()//define function        Perimeter {return (width + height) * 2; }        }    }}

Perimeter and area

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: 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.