Advertisement
ivanov_ivan

Area

Mar 15th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Area
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var figure = Console.ReadLine().ToLower();
  14.             var a = double.Parse(Console.ReadLine());
  15.  
  16.             if(figure == "square")
  17.             {
  18.  
  19.                 Console.WriteLine(Math.Round(a * a , 3));
  20.             }
  21.             else if(figure == "circle")
  22.             {
  23.  
  24.                 Console.WriteLine(Math.Round(a * a * Math.PI , 3));
  25.             }
  26.             else
  27.             {
  28.                 var b = double.Parse(Console.ReadLine());
  29.  
  30.                 if(figure == "triangle")
  31.                 {
  32.  
  33.                     Console.WriteLine(Math.Round(a * b / 2 , 3));
  34.                 }
  35.                 if(figure == "rectangle")
  36.                 {
  37.  
  38.                     Console.WriteLine(Math.Round(a * b , 3));
  39.                 }
  40.             }
  41.  
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement