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 ConsoleApp19
- {
- class Program
- {
- static void Main(string[] args)
- {
- string inputFigure = Console.ReadLine().ToLower();
- if (inputFigure == "square")
- {
- double area = double.Parse(Console.ReadLine());
- Console.WriteLine($"{ area* area:f3}");
- }
- else if (inputFigure == "rectangle")
- {
- double areaOfRectangle = double.Parse(Console.ReadLine());
- double perimeterOfRectangle = double.Parse(Console.ReadLine());
- Console.WriteLine($"{areaOfRectangle * perimeterOfRectangle:f3}");
- }
- else if (inputFigure == "circle")
- {
- double r = double.Parse(Console.ReadLine());
- Console.WriteLine($"{r * r * Math.PI:f3}");
- }
- else if(inputFigure == "triangle")
- {
- double width = double.Parse(Console.ReadLine());
- double height = double.Parse(Console.ReadLine());
- Console.WriteLine($"{width * height /2:f3}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement