Q:

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

belongs to collection: C# Basic Programs | basics

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 . . .

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | basics

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to demonstrate the example of the right... >>
<< C# program to read the grade of students and print...