C# program to calculate the size of the area in square-feet based on specified length and width

Given length and height and we have to calculate the size of the area in square-feet using a C# program.
Submitted by Nidhi, on August 18, 2020

Here we will take the length and width of the area as user input and then calculate the size of the area in square feet then print on the console screen.

Program:

The source code to calculate the size of the area in square-feet in C# is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

// Program to calculate the size of the area in 
// square-feet based on specified height and width in C#.

using System;

class AreaDemo
{
    static int calculateArea(int lengthInFeets, int widthInFeets)
    {
        return (lengthInFeets * widthInFeets);
    }
    public static void Main()
    {
        int lengthInFeets = 0;
        int widthInFeets = 0;
        int plotArea = 0;


        Console.Write("Enter length of the plot in feets: ");
        lengthInFeets = Convert.ToInt32(Console.ReadLine());

        Console.Write("Enter width of room in feet:");
        widthInFeets = Convert.ToInt32(Console.ReadLine());

        plotArea = calculateArea(lengthInFeets, widthInFeets);

        Console.WriteLine("Plot area is "+plotArea+" square feet");
    }
}

Output:

Enter length of the plot in feets: 20
Enter width of room in feet:36
Plot area is 720 square feet
Press any key to continue . . .





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.