Advertisement
Laudanum-user

Untitled

Oct 30th, 2022
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. Console.WriteLine("Task: I_2");
  2.  
  3. static double S(double a, double b, double c)
  4. {
  5.     double p = (a + b + c) / 2;
  6.     return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
  7. }
  8.  
  9. Console.Write("double a1 = "); double a1 = double.Parse(Console.ReadLine()!);
  10. Console.Write("double b1 = "); double b1 = double.Parse(Console.ReadLine()!);
  11. Console.Write("double c1 = "); double c1 = double.Parse(Console.ReadLine()!);
  12. Console.Write("double a2 = "); double a2 = double.Parse(Console.ReadLine()!);
  13. Console.Write("double b2 = "); double b2 = double.Parse(Console.ReadLine()!);
  14. Console.Write("double c2 = "); double c2 = double.Parse(Console.ReadLine()!);
  15.  
  16. double s1 = S(a1, b1, c1), s2 = S(a2, b2, c2);
  17. string c = s1 > s2 ? ">" : (s1 < s2 ? "<" : "==");
  18. Console.WriteLine("S1 = {0} " + c + " S2 = {1}", s1, s2);
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement