Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace geomtry_calc
  8. {
  9. class Program
  10. { static void vuvedi_dvechisla(string vid, double one,double two)
  11. {
  12. if (vid == "triangle") { double area = one * two / 2; Console.WriteLine($"{area:f2}"); }
  13. else if (vid == "rectangle") { double area = one * two; Console.WriteLine($"{area:f2}"); }
  14.  
  15. }
  16. static void vuvedi_ednochisla(string vid, double one)
  17. {
  18. if (vid == "square") { double area = one * one; Console.WriteLine($"{area:f2}"); }
  19. else if (vid == "circle") {double circleArea = 3.14159265359; double area = one *one*circleArea; Console.WriteLine($"{area:f2}"); }
  20.  
  21. }
  22. static void Main(string[] args)
  23. {
  24. string type = Console.ReadLine();
  25. double one = double.Parse(Console.ReadLine());
  26.  
  27. if (type == "triangle" || type == "rectangle"){
  28. double two = double.Parse(Console.ReadLine());
  29. vuvedi_dvechisla(type,one,two);
  30. }
  31. else vuvedi_ednochisla(type, one);
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement