Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _13__Area_of_figures
- {
- class Program
- {
- static void Main(string[] args)
- {
- string figure = Console.ReadLine();
- if (figure == "square")
- {
- var a = double.Parse(Console.ReadLine());
- var square = Math.Round(a * a, 3);
- Console.WriteLine(square);
- }
- else if (figure == "rectangle")
- {
- var c = double.Parse(Console.ReadLine());
- var d = double.Parse(Console.ReadLine());
- var rectangle = Math.Round(c * d, 3);
- Console.WriteLine(rectangle);
- }
- else if (figure == "circle")
- {
- var r = double.Parse(Console.ReadLine());
- var circle = Math.Round(Math.PI * r * r, 3);
- Console.WriteLine(circle);
- }
- else if (figure == "triangle")
- {
- var side = double.Parse(Console.ReadLine());
- var h = double.Parse(Console.ReadLine());
- var triangle = Math.Round(side * h / 2, 3);
- Console.WriteLine(triangle);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement