Advertisement
EmoRz

Area

Jun 21st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2.  
  3. namespace AreaFigura
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string[] data = {"square", "rectangle", "circle","triangle" };
  10.             string type = Console.ReadLine();
  11.             double bank = 0.0;
  12.             if (type==data[0])
  13.             {
  14.                 double a = double.Parse(Console.ReadLine());
  15.                 bank = a * a;
  16.  
  17.             }
  18.             else if (type == data[1])
  19.             {
  20.                 double a = double.Parse(Console.ReadLine());
  21.                 double b = double.Parse(Console.ReadLine());
  22.                 bank = a * b;
  23.             }
  24.             else if (type == data[2])
  25.             {
  26.                 double radius = double.Parse(Console.ReadLine());
  27.                 bank = Math.PI * Math.Pow(radius,2);
  28.             }
  29.             else if (type == data[3])
  30.             {
  31.                 double a = double.Parse(Console.ReadLine());
  32.                 double b = double.Parse(Console.ReadLine());
  33.                 bank = a * b/2;
  34.             }
  35.             Console.WriteLine(Math.Round(bank,3));
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement