Created
September 16, 2019 10:50
-
-
Save gagannn/8e17e2a312e70083351dfe2afe1cfd8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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