Advertisement
KrasenPenev

Untitled

Jan 18th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 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 Area_of_Figures
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string typeOfFigure = Console.ReadLine();
  14.  
  15. if (typeOfFigure == "square")
  16. {
  17. double parameterForArea = double.Parse(Console.ReadLine());
  18. double area = parameterForArea * parameterForArea;
  19. Console.WriteLine($"{area:F3}");
  20. }
  21. else if (typeOfFigure== "rectangle")
  22. {
  23.  
  24. int sideA = int.Parse(Console.ReadLine());
  25. double sideB = double.Parse(Console.ReadLine());
  26.  
  27. double resultArea = sideA * sideB;
  28.  
  29. Console.WriteLine($"{resultArea:F3}");
  30. }
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement