Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class RectangleArea
- {
- static void Main()
- {
- double height, width;
- Console.Write("Enter width: ");
- if (double.TryParse(Console.ReadLine(), out width) && width > 0 && width <= double.MaxValue)
- {
- Console.Write("Enter height: ");
- if (double.TryParse(Console.ReadLine(), out height) && height > 0 && height <= double.MaxValue)
- {
- Console.WriteLine("\nRectangle area: {0} * {1} = {2}\n", width, height, width*height);
- Console.WriteLine("{0}\n", new string('=',40));
- Main();
- }
- else
- {
- Console.WriteLine("Please enter value between {0} and {1}\n", 0, double.MaxValue);
- Main();
- }
- }
- else
- {
- Console.WriteLine("Please enter value between {0} and {1}\n", 0, double.MaxValue);
- Main();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment