Created
January 17, 2017 15:18
-
-
Save Nikola-Andreev/71442cc84d08c21aea2f29c6a86c3f20 to your computer and use it in GitHub Desktop.
Area of figures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Numerics; | |
using System.Globalization; | |
using System.Text.RegularExpressions; | |
namespace Praktice | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string word = (Console.ReadLine()); | |
if (word == "square") | |
{ | |
var a = double.Parse(Console.ReadLine()); | |
var area = a * a; | |
Console.WriteLine(area); | |
} | |
if (word == "rectangle") | |
{ | |
var x = double.Parse(Console.ReadLine()); | |
var y = double.Parse(Console.ReadLine()); | |
var area1 = x * y; | |
Console.WriteLine(area1); | |
} | |
if (word == "circle") | |
{ | |
var r = double.Parse(Console.ReadLine()); | |
Console.WriteLine("Area = " + Math.PI * r * r); | |
} | |
if (word == "triangle") | |
{ | |
var a = double.Parse(Console.ReadLine()); | |
var h = double.Parse(Console.ReadLine()); | |
var area2 = a * h / 2; | |
Console.WriteLine(Math.Round(area2, 2)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment