Skip to content

Instantly share code, notes, and snippets.

@gagannn
Created September 16, 2019 10:50
Show Gist options
  • Save gagannn/8e17e2a312e70083351dfe2afe1cfd8c to your computer and use it in GitHub Desktop.
Save gagannn/8e17e2a312e70083351dfe2afe1cfd8c to your computer and use it in GitHub Desktop.
using System;
namespace Lab5_Structures
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter length: ");
int length = Int32.Parse(Console.ReadLine());
Console.Write("Enter breadth: ");
int breadth = Int32.Parse(Console.ReadLine());
Rectangle r = new Rectangle(length, breadth);
Console.WriteLine("Area is: " + r.getArea());
}
public struct Rectangle
{
public int length;
public int breadth;
public Rectangle(int l,int b)
{
length = l;
breadth = b;
}
public int getArea()
{
return length * breadth;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment