Advertisement
Guest User

hhQuest

a guest
Sep 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.10 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 hhQuest
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {            
  13.             start();
  14.         }
  15.         static void choose(string figure)
  16.         {
  17.             switch (figure)
  18.             {
  19.                 case "circle":
  20.                     circle();
  21.                     start();
  22.                     break;
  23.                 default:
  24.                     Console.WriteLine("No figure found, enter data again");
  25.                     start();
  26.                     break;
  27.             }
  28.  
  29.         }
  30.         static void start()
  31.         {
  32.             Console.WriteLine("Choose figure \n circle");
  33.             string figure = Console.ReadLine();            
  34.             choose(figure);
  35.         }
  36.         static void circle()
  37.         {
  38.             double square, a, b, c, radius;
  39.             bool isRectangularBool = false;
  40.             Console.WriteLine("Enter radius");
  41.             radius = Convert.ToDouble(Console.ReadLine());
  42.             Console.WriteLine("Enter the side of triangle A");
  43.             a = Convert.ToDouble(Console.ReadLine());
  44.             Console.WriteLine("Enter the side of triangle A");
  45.             b = Convert.ToDouble(Console.ReadLine());
  46.             Console.WriteLine("Enter the side of triangle A");
  47.             c = Convert.ToDouble(Console.ReadLine());
  48.             isRectangularBool = isRectangular(a, b, c);
  49.             square = (a * b * c) / (4 * radius);
  50.             Console.WriteLine("The area of ​​the circle is " + square + ". Is the triangle rectangular ? " + isRectangularBool);
  51.         }
  52.         static bool isRectangular(double a, double b, double c)
  53.         {
  54.             bool isRectangularBool = false;
  55.             double a2, b2, c2;
  56.             a2 = Math.Sqrt((b * b + c * c));
  57.             b2 = Math.Sqrt((a * a + c * c));
  58.             c2 = Math.Sqrt((b * b + a * a));
  59.             if ((a == a2)|| (b == b2)|| (c == c2)) isRectangularBool  = true;
  60.             return isRectangularBool;
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement