pupesko

SoftUni - 5.4 Rectangles

Oct 10th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. //Write an expression that calculates rectangle’s perimeter and area by given width and height.
  2.  
  3. using System;
  4.  
  5. class PerimeterArean
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write("Enter width: ");
  10.         string a = Console.ReadLine();
  11.         double width = double.Parse(a);
  12.  
  13.         Console.Write("Enter width: ");
  14.         string b = Console.ReadLine();
  15.         int height = int.Parse(b);
  16.  
  17.         Console.WriteLine("Perimeter = " + 2 * (width + height) + ". Area = " + (width * height) + ".");
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment