Advertisement
kuruku

AreaOfTrapezoid

Apr 16th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2.  
  3.     //Write an expression that calculates the area of a trapezoid by give sides a, b and height h.
  4.  
  5. class AreaOfTrapezoid
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write("a = ");
  10.         int a = int.Parse(Console.ReadLine());
  11.         Console.Write("b = ");
  12.         int b = int.Parse(Console.ReadLine());
  13.         Console.Write("h = ");
  14.         int h = int.Parse(Console.ReadLine());
  15.  
  16.         double area = (a + b) * h / 2;
  17.         Console.WriteLine();
  18.         Console.WriteLine("Trapeoid Area = {0}", area);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement