Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Figures
- {
- class Program
- {
- static void Main()
- {
- string figures = Console.ReadLine();
- double num1 = double.Parse(Console.ReadLine());
- double sum = 0;
- if (figures == "square")
- {
- sum = num1 * num1;
- }
- else if (figures == "rectangle")
- {
- double num2 = double.Parse(Console.ReadLine());
- sum = num1 * num2;
- }
- else if (figures == "circle")
- {
- sum = Math.PI * num1 * num1;
- }
- else if (figures == "triangle")
- {
- double num2 = double.Parse(Console.ReadLine());
- sum = num1 * num2 / 2;
- }
- Console.WriteLine($"{sum:f3}");
- }
- }
- }
Add Comment
Please, Sign In to add comment