JewishCat

Q1

May 26th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double a, b, c;
  14.             Console.WriteLine("Enter the number");
  15.             a = Convert.ToDouble(Console.ReadLine());
  16.             b = Convert.ToDouble(Console.ReadLine());
  17.             c = Convert.ToDouble(Console.ReadLine());
  18.  
  19.             Console.WriteLine(S(a,b,c));
  20.  
  21.         }
  22.         static double S(double a, double b, double c)
  23.         {
  24.             double s = 0;
  25.             if ((a < b && b < c) || (a > b && a < c))
  26.             {
  27.                 s = 0.5 * a * b;
  28.             } else {
  29.                 if (a < b && a > c)
  30.                 {
  31.                     s = 0.5 * a * c;
  32.                 } else
  33.                 {
  34.                     s = 0.5 * b * c;
  35.                 }
  36.             }
  37.             return s;
  38.         }
  39.     }
  40. }
Add Comment
Please, Sign In to add comment