Advertisement
andruhovski

DemoCSharp002

May 6th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApplication2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double x, y, z;            
  10.             bool isCorrect;
  11.             Console.WriteLine( "Задайте x");
  12.             string line = Console.ReadLine();
  13.             if (!double.TryParse(line,out x))
  14.                 return;
  15.             Console.WriteLine( "Задайте y");
  16.             line = Console.ReadLine();
  17.             if (!double.TryParse(line, out y))
  18.                 return;
  19.             Console.WriteLine( "Задайте z");
  20.             line = Console.ReadLine();
  21.             if (!double.TryParse(line, out z))
  22.                 return;
  23.             Console.WriteLine( Geron(x,y,z) );
  24.         }
  25.  
  26.         static double Geron(double a, double b, double c)
  27.         {
  28.             double p = (a + b + c)/2.0;
  29.             return Math.Sqrt(p*(p - a)*(p - b)*(p - c));
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement