using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
public class data
{
public int l, b;
public void getdata()
{
Console.Write("Enter length and breadth");
l = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
}
}
public class area:data
{
public int ar;
public void area1()
{
ar = l * b;
}
}
public class perimeter : area
{
public int peri;
public void peri1()
{
peri = 2*(l + b);
}
public void showdata()
{
Console.Write("The area is:" + ar);
Console.Write("The perimeter is:"+peri);
}
}
static void Main(string[] args)
{
perimeter p = new perimeter();
p.getdata();
p.area1();
p.peri1();
p.showdata();
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
public class data
{
public int l, b;
public void getdata()
{
Console.Write("Enter length and breadth");
l = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
}
}
public class area:data
{
public int ar;
public void area1()
{
ar = l * b;
}
}
public class perimeter : area
{
public int peri;
public void peri1()
{
peri = 2*(l + b);
}
public void showdata()
{
Console.Write("The area is:" + ar);
Console.Write("The perimeter is:"+peri);
}
}
static void Main(string[] args)
{
perimeter p = new perimeter();
p.getdata();
p.area1();
p.peri1();
p.showdata();
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/
No comments:
Post a Comment