VelizarAvramov

02. Rectangle Area

Jul 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. Write a program, which calculates a rectangle’s area, based on its width and height. The width and height come as floating point numbers on the console, formatted to the 2nd character after the decimal point.
  2. using System;
  3.  
  4. namespace _02._Rectangle_Area
  5. {
  6.     class RectangleArea
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double width = double.Parse(Console.ReadLine());
  11.             double hieght = double.Parse(Console.ReadLine());
  12.  
  13.             double area = width * hieght;
  14.             Console.WriteLine($"{area:F2}");
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment