SHARE
TWEET

Untitled

a guest Feb 21st, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Area_of_Figures
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string figures = Console.ReadLine();
  10.             double side1 = double.Parse(Console.ReadLine());
  11.             double side2 = double.Parse(Console.ReadLine());
  12.  
  13.             double areaSquare = side1 * side1;
  14.             double areaRectange = side1 * side2;
  15.             double areaCircle = Math.PI * (side1 * side1);
  16.             double areaTriangle = (side1 * side2) / 2;
  17.  
  18.             if (figures == "square")
  19.             {
  20.                 Console.WriteLine($"{areaSquare:F3}");
  21.             }
  22.             else if (figures == "rectangle")
  23.             {
  24.                 Console.WriteLine($"{areaRectange:F3}");
  25.             }
  26.             else if (figures == "circle")
  27.             {
  28.                 Console.WriteLine($"{areaCircle:F3}");
  29.             }
  30.             else if (figures == "triangle")
  31.             {
  32.                 Console.WriteLine($"{areaTriangle:F3}");
  33.             }
  34.         }
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top