Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class Rectangles
- {
- static void Main()
- {
- //Perimeter = 2(h+w); Area = w*h;
- float rectWidth, rectHeight;
- Console.WriteLine("Please, enter rectangle width:");
- while (!float.TryParse(Console.ReadLine(), out rectWidth))
- {
- Console.WriteLine("\nPlease, enter correct width.\n");
- }
- Console.WriteLine("Please, enter rectangle height:");
- while (!float.TryParse(Console.ReadLine(), out rectHeight))
- {
- Console.WriteLine("\nPlease, enter correct height.\n");
- }
- Console.WriteLine("Perimeter: {0}; Area: {1}", 2 * (rectHeight + rectWidth), (rectWidth * rectHeight));
- Console.WriteLine("Press any key to exit.");
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement