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 Area
- {
- class Program
- {
- static void Main(string[] args)
- {
- var figure = Console.ReadLine().ToLower();
- var a = double.Parse(Console.ReadLine());
- if(figure == "square")
- {
- Console.WriteLine(Math.Round(a * a , 3));
- }
- else if(figure == "circle")
- {
- Console.WriteLine(Math.Round(a * a * Math.PI , 3));
- }
- else
- {
- var b = double.Parse(Console.ReadLine());
- if(figure == "triangle")
- {
- Console.WriteLine(Math.Round(a * b / 2 , 3));
- }
- if(figure == "rectangle")
- {
- Console.WriteLine(Math.Round(a * b , 3));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement