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 hhQuest
- {
- class Program
- {
- static void Main(string[] args)
- {
- start();
- }
- static void choose(string figure)
- {
- switch (figure)
- {
- case "circle":
- circle();
- start();
- break;
- default:
- Console.WriteLine("No figure found, enter data again");
- start();
- break;
- }
- }
- static void start()
- {
- Console.WriteLine("Choose figure \n circle");
- string figure = Console.ReadLine();
- choose(figure);
- }
- static void circle()
- {
- double square, a, b, c, radius;
- bool isRectangularBool = false;
- Console.WriteLine("Enter radius");
- radius = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Enter the side of triangle A");
- a = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Enter the side of triangle A");
- b = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Enter the side of triangle A");
- c = Convert.ToDouble(Console.ReadLine());
- isRectangularBool = isRectangular(a, b, c);
- square = (a * b * c) / (4 * radius);
- Console.WriteLine("The area of the circle is " + square + ". Is the triangle rectangular ? " + isRectangularBool);
- }
- static bool isRectangular(double a, double b, double c)
- {
- bool isRectangularBool = false;
- double a2, b2, c2;
- a2 = Math.Sqrt((b * b + c * c));
- b2 = Math.Sqrt((a * a + c * c));
- c2 = Math.Sqrt((b * b + a * a));
- if ((a == a2)|| (b == b2)|| (c == c2)) isRectangularBool = true;
- return isRectangularBool;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement