Advertisement
Guest User

Untitled

a guest
Sep 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6.  
  7. class Program
  8.  
  9. {
  10.     static int f(uint x) {
  11.         return (int)x*(int)x;
  12.     }
  13.     static void change (uint x, uint y, uint z, out uint a1, out uint a2,out uint a3){
  14.         a1 = x > y ? (y > z ? z : y) : (x > z ? z : x);
  15.         a2 = x > y ? (x < z ? x : (z < y ? y : z)) : (y < z ? y : (x > z ? x : y));
  16.         a3 = x > y ? (x > z ? x : z) : (y > z ? y : z);
  17.     }
  18.     static bool check(uint a, uint b, uint c) {
  19.         bool check_answer = (a + b) > c & (a + c) > b & (b + c) > a ? true : false;
  20.         return check_answer;
  21.     }
  22.     static string get_answer(uint big_side, uint mid_side, uint sm_side) {
  23.         string answer;
  24.         return answer = f(big_side) >= f(mid_side) + f(sm_side) ? (f(big_side) > f(mid_side) + f(sm_side) ? "obtuse" : "right") : ("acute");
  25.     }
  26.     static void Main()
  27.     {
  28.         uint side_1, side_2, side_3, sm_side, mid_side, big_side;
  29.         string input_1, input_2, input_3;
  30.         input_1 = Console.ReadLine();
  31.         if (!uint.TryParse(input_1, out side_1))
  32.         {
  33.             Console.WriteLine("wrong");
  34.             Console.ReadLine();
  35.         }
  36.         else
  37.         {
  38.             input_2 = Console.ReadLine();
  39.             if (!uint.TryParse(input_2, out side_2))
  40.             {
  41.                 Console.WriteLine("wrong");
  42.                 Console.ReadLine();
  43.             }
  44.             else
  45.             {
  46.                 input_3 = Console.ReadLine();
  47.                 if (!uint.TryParse(input_3, out side_3))
  48.                 {
  49.                     Console.WriteLine("wrong");
  50.                     Console.ReadLine();
  51.                 }
  52.  
  53.                 else
  54.                 {
  55.                     change(side_1, side_2, side_3, out sm_side, out mid_side, out big_side);
  56.                     Console.WriteLine(check(side_1, side_2, side_3) ? get_answer(big_side, mid_side, sm_side) : "impossible");
  57.                     Console.ReadLine();
  58.                 }
  59.             }
  60.         }
  61.         }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement