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