Advertisement
VickyFilly

C#Basics_FiguresAreas

Feb 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. class Program
  7. {
  8.     static void Main()
  9.     {
  10.         string figure = Console.ReadLine().ToLower();
  11.         double num1 = double.Parse(Console.ReadLine());
  12.  
  13.         if (figure == "rectangle")
  14.         {
  15.             double num2 = double.Parse(Console.ReadLine());
  16.             Console.WriteLine(num1 * num2);
  17.         }
  18.         else if (figure == "triangle")
  19.         {
  20.             double num2 = double.Parse(Console.ReadLine());
  21.             Console.WriteLine(num1 * num2 / 2);
  22.         }
  23.         else if (figure == "square")
  24.         {
  25.             Console.WriteLine(num1 * num1);
  26.         }
  27.         else if (figure == "circle")
  28.         {
  29.             Console.WriteLine(Math.PI * num1 * num1);
  30.         }
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement