Advertisement
VyaraG

Reactangles

Nov 28th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2.  
  3. //Write an expression that calculates rectangle’s perimeter and area by given width and height
  4.  
  5. class Rectangles
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write("Enter the width of the rectangle: ");
  10.         double rectangleWidth = double.Parse(Console.ReadLine());
  11.         Console.Write("Enter the height of a rectangle: ");
  12.         double rectangleHeight = double.Parse(Console.ReadLine());
  13.         double rectanglePerimitre = 2 * rectangleHeight + 2 * rectangleWidth;
  14.         Console.WriteLine("The perimetre of the rectangle is: {0}", rectanglePerimitre);
  15.         double rectangleArea = rectangleHeight * rectangleWidth;
  16.         Console.WriteLine("The area of the rectangle is: {0}", rectangleArea);
  17.  
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement