The
perimeter is equal to the length of the boundary around the rectangle.
Perimeter
of rectangle = 2l+2w
Perimeter
of square = 4 * sides
SOURCE CODE :-
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace perimeter
{
class peri
{
public void perime()
{
double
l_rectangle, b_rectangle;
double
p_rectangle;
double
sides;
double
p_square;
Console.WriteLine("enter the value of length and breadth of
rectangle");
l_rectangle = double.Parse(Console.ReadLine());
b_rectangle = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the sides of the square");
sides = double.Parse(Console.ReadLine());
p_rectangle = 2 * l_rectangle + 2 *
b_rectangle;
p_square = 4 * sides;
Console.WriteLine("the perimeter of rectangle" +
p_rectangle);
Console.WriteLine("the perimeter of square" + p_square);
}
}
class Program
{
static void Main(string[]
args)
{
peri
b = new peri();
b.perime();
}
}
}
OUTPUT :-
enter the value of
length and breadth of rectangle
3
3
Enter the sides of
the square
5
the perimeter of
rectangle 12
the perimeter of
square 16
No comments:
Write comments