Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Area_of_Figures
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fig = Console.ReadLine();
- if (fig == "square")
- {
- double a = 5;
- Console.WriteLine($"{a * a:f3}");
- }
- else if (fig == "rectangle")
- {
- double a = 7;
- double b = 2.5;
- Console.WriteLine($"{a * b:f3}");
- }
- else if (fig == "circle")
- {
- double r = 6;
- Console.WriteLine($"{r * r * Math.PI:f3}");
- }
- else if (fig == "triangle")
- {
- double side = 4.5;
- double h = 20;
- Console.WriteLine($"{side * h / 2:f3}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment