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 geomtry_calc
- {
- class Program
- { static void vuvedi_dvechisla(string vid, double one,double two)
- {
- if (vid == "triangle") { double area = one * two / 2; Console.WriteLine($"{area:f2}"); }
- else if (vid == "rectangle") { double area = one * two; Console.WriteLine($"{area:f2}"); }
- }
- static void vuvedi_ednochisla(string vid, double one)
- {
- if (vid == "square") { double area = one * one; Console.WriteLine($"{area:f2}"); }
- else if (vid == "circle") {double circleArea = 3.14159265359; double area = one *one*circleArea; Console.WriteLine($"{area:f2}"); }
- }
- static void Main(string[] args)
- {
- string type = Console.ReadLine();
- double one = double.Parse(Console.ReadLine());
- if (type == "triangle" || type == "rectangle"){
- double two = double.Parse(Console.ReadLine());
- vuvedi_dvechisla(type,one,two);
- }
- else vuvedi_ednochisla(type, one);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement