SHARE
TWEET

Untitled

a guest Oct 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3.     class Program
  4.     {
  5.         static void Main()
  6.         {
  7.             string figura = Console.ReadLine();
  8.             if (figura == "square")
  9.             {
  10.                 double a = double.Parse(Console.ReadLine());
  11.                 double area = a * a;
  12.                 Console.WriteLine("{0:F3}", area);
  13.             }
  14.             else if (figura == "rectangle")
  15.             {
  16.                 double a = double.Parse(Console.ReadLine());
  17.                 double b = double.Parse(Console.ReadLine());
  18.                 double area = a * b;
  19.                 Console.WriteLine("{0:F3}", area);
  20.             }
  21.             if (figura == "circle")
  22.             {
  23.                 double r = double.Parse(Console.ReadLine());
  24.                 double area = Math.PI * r * r;
  25.                 Console.WriteLine("{0:F3}", area);
  26.             }
  27.             else if (figura == "triangle")
  28.             {
  29.                 double a = double.Parse(Console.ReadLine());
  30.                 double h = double.Parse(Console.ReadLine());
  31.                 double area = a * h / 2;
  32.                 Console.WriteLine("{0:F3}", area);
  33.             }
  34.         }
  35.     }
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