Advertisement
adriyanbulgary

OperatorsExpressionsAndStatements - Task 9

Jun 13th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2. /*
  3.  * Write an expression that calculates trapezoid's area by given sides a and b and height h.
  4.  */
  5. class TrapezoidArea
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write("Please enter the first side\t a = ");
  10.         double sideA = double.Parse(Console.ReadLine());
  11.         Console.Write("\nPlease enter the second side\t b = ");
  12.         double sideB = double.Parse(Console.ReadLine());
  13.         Console.Write("\nPlease enter the trapezoid's height:\t h =");
  14.         double heightH = double.Parse(Console.ReadLine());
  15.         double area = ((sideA + sideB) / 2) * heightH;
  16.  
  17.         Console.WriteLine("\n\t\tThe area is: {0}\n",area);
  18.  
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement