Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class RectangleArea
- {
- static void Main()
- {
- Console.WriteLine("Please enter the height of the rectangle.");//Instructions for the user
- double height = double.Parse(Console.ReadLine());
- Console.WriteLine("Please enter the width of the rectangle.");
- double width = double.Parse(Console.ReadLine());
- if (height>0 && width>0) //checks if input numbers are positive.
- {
- double rectangleArea = height * width;
- Console.WriteLine("The rectangle area is {0}.", rectangleArea);
- }
- else
- {
- Console.WriteLine("Please enter positive numbers.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement