:- The area of a rectangle is equal to the number of unit
squares that can be fit between the boundaries the rectangle.
Area = a2
a = length of side
Output:-a = length of side
SOURCE CODE :-
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace area { class rectangle { public void are() { double l_rectangle, b_rectangle; double a_rectangle; double sides; double a_square; Console.WriteLine("enter the value of lenght and bredth of rectangle "); l_rectangle =double.Parse(Console.ReadLine()); b_rectangle =double.Parse(Console.ReadLine()); a_rectangle = l_rectangle * b_rectangle; Console.WriteLine("the area of rect is=" + a_rectangle); Console.WriteLine("Enter the sides of the square"); sides = double.Parse(Console.ReadLine()); a_square=sides*sides; Console.WriteLine("the area of square is=" + a_square); } } class program { static void Main(string[] args) { rectangle b = new rectangle(); b.are(); } } }
enter the value of lenght and bredth of rectangle 4 4 the area of rect is =16 Enter the sides of the square 5 The area of square is =25
No comments:
Write comments