Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace AreaFigura
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] data = {"square", "rectangle", "circle","triangle" };
- string type = Console.ReadLine();
- double bank = 0.0;
- if (type==data[0])
- {
- double a = double.Parse(Console.ReadLine());
- bank = a * a;
- }
- else if (type == data[1])
- {
- double a = double.Parse(Console.ReadLine());
- double b = double.Parse(Console.ReadLine());
- bank = a * b;
- }
- else if (type == data[2])
- {
- double radius = double.Parse(Console.ReadLine());
- bank = Math.PI * Math.Pow(radius,2);
- }
- else if (type == data[3])
- {
- double a = double.Parse(Console.ReadLine());
- double b = double.Parse(Console.ReadLine());
- bank = a * b/2;
- }
- Console.WriteLine(Math.Round(bank,3));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement