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