ahmed_so

Untitled

Feb 18th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Area_of_Figures
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string fig = Console.ReadLine();
  10.  
  11.             if (fig == "square")
  12.             {
  13.                 double a = 5;
  14.                 Console.WriteLine($"{a * a:f3}");
  15.             }
  16.  
  17.             else if (fig == "rectangle")
  18.             {
  19.                 double a = 7;
  20.                 double b = 2.5;
  21.                 Console.WriteLine($"{a * b:f3}");
  22.             }
  23.             else if (fig == "circle")
  24.             {
  25.                 double r = 6;
  26.                 Console.WriteLine($"{r * r * Math.PI:f3}");
  27.             }
  28.             else if (fig == "triangle")
  29.             {
  30.                 double side = 4.5;
  31.                 double h = 20;
  32.                 Console.WriteLine($"{side * h / 2:f3}");
  33.             }
  34.  
  35.         }
  36.     }
  37. }
Add Comment
Please, Sign In to add comment