BloodMoonYTC

pitagorasz

Oct 24th, 2021 (edited)
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace pitagrasztetel
  4. {
  5.     class Program
  6.     {
  7.         static double atfogo(double a, double b, out double T)
  8.         {
  9.             double c = Math.Sqrt(a * a + b * b);
  10.             T = (a * b) / 2;
  11.             return c;
  12.         }
  13.         static void Main(string[] args)
  14.         {
  15.             double a, b, t;
  16.             while (true)
  17.             {
  18.                 Console.Write("Befogó A: ");
  19.                 a = double.Parse(Console.ReadLine());
  20.                 Console.Write("Befogó B: ");
  21.                 b = double.Parse(Console.ReadLine());
  22.  
  23.                 if (a <= 0 || b <= 0) break;
  24.  
  25.                 Console.WriteLine("A háromszög befogói a={0}, b={1}, c={2}, Terület T={3}", a, b, atfogo(a, b, out t), t);
  26.  
  27.                 Console.WriteLine("Kólity Kristóf");
  28.                 Console.WriteLine("Enter nyomásával újraindítható a program.");
  29.                 Console.ReadLine();
  30.             }
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment