Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- {
- var figure = (Console.ReadLine());
- var area = 0.0;
- if (figure == "square")
- {
- var sideofSquare = double.Parse(Console.ReadLine());
- area = sideofSquare * sideofSquare;
- Console.WriteLine(Math.Round(area, 3));
- }
- else if (figure == "rectangle")
- {
- var sideOne = double.Parse(Console.ReadLine());
- var sideTwo = double.Parse(Console.ReadLine());
- area = sideOne * sideTwo;
- Console.WriteLine(Math.Round(area,3));
- }
- else if (figure == "circle")
- {
- var r = double.Parse(Console.ReadLine());
- area = r * r * Math.PI;
- Console.WriteLine(Math.Round(area, 3));
- }
- else if (figure == "triangle")
- {
- var side = double.Parse(Console.ReadLine());
- var hight = double.Parse(Console.ReadLine());
- area = side * hight / 2;
- Console.WriteLine(Math.Round(area, 3));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement