Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //Write an expression that calculates trapezoid's area by given sides a and b and height h. Examples:
- //formula: ((a+b)*h)/2
- class Trapezoids
- {
- static void Main()
- {
- Console.Write("Enter value for one of the trapezoid's bases: ");
- double a = double.Parse(Console.ReadLine()); //double - to calculate numbers with a floating point
- Console.Write("Enter value for the other of the trapezoid's bases: ");
- double b = double.Parse(Console.ReadLine());
- Console.Write ("Enter a value for the height of the trapezoid: ");
- double h = double.Parse(Console.ReadLine());
- double area = ((a + b) * h) / 2;
- Console.WriteLine("The area of the trapezoid is: {0}", area);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement