Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //Write an expression that calculates rectangle’s perimeter and area by given width and height
- class Rectangles
- {
- static void Main()
- {
- Console.Write("Enter the width of the rectangle: ");
- double rectangleWidth = double.Parse(Console.ReadLine());
- Console.Write("Enter the height of a rectangle: ");
- double rectangleHeight = double.Parse(Console.ReadLine());
- double rectanglePerimitre = 2 * rectangleHeight + 2 * rectangleWidth;
- Console.WriteLine("The perimetre of the rectangle is: {0}", rectanglePerimitre);
- double rectangleArea = rectangleHeight * rectangleWidth;
- Console.WriteLine("The area of the rectangle is: {0}", rectangleArea);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement