Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 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. namespace _13__Area_of_figures
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string figure = Console.ReadLine();
  13. if (figure == "square")
  14. {
  15. var a = double.Parse(Console.ReadLine());
  16. var square = Math.Round(a * a, 3);
  17. Console.WriteLine(square);
  18. }
  19. else if (figure == "rectangle")
  20. {
  21. var c = double.Parse(Console.ReadLine());
  22. var d = double.Parse(Console.ReadLine());
  23. var rectangle = Math.Round(c * d, 3);
  24. Console.WriteLine(rectangle);
  25. }
  26. else if (figure == "circle")
  27. {
  28. var r = double.Parse(Console.ReadLine());
  29. var circle = Math.Round(Math.PI * r * r, 3);
  30. Console.WriteLine(circle);
  31. }
  32. else if (figure == "triangle")
  33. {
  34. var side = double.Parse(Console.ReadLine());
  35. var h = double.Parse(Console.ReadLine());
  36. var triangle = Math.Round(side * h / 2, 3);
  37. Console.WriteLine(triangle);
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement