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 RectanglePerimeterArea
- {
- static void Main()
- {
- int height;
- int width;
- long perimeter;
- long area;
- Console.WriteLine("Please enter the height of the rectangle");
- height = int.Parse(Console.ReadLine());
- Console.WriteLine("Please enter the width of the rectangle");
- width = int.Parse(Console.ReadLine());
- perimeter = 2 * (height + width);
- area = height * width;
- Console.WriteLine("The perimeter is {0}\nThe area is {1}",perimeter,area);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement