C program to find area of rectangle

devquora
devquora

Posted On: Dec 23, 2020

C program to find area of rectangle

 

Overview:

In general, the term “area” is defined as the region occupied inside the boundary of a flat object or figure. Before, Starting this article First of all, I want to introduce you with Geometric Shape rectangle. Then I will explain What do you mean by area of a rectangle. Moreover, I will demonstrate how to find area of a rectangle? Furthermore, I will write logic and c program to find area of rectangle with output. After all, I will explain the resultant output.

Table of contents:

  1. What are the characteristics of quadrilateral?
  2. What is a Rectangle?
  3. What are the properties of the Rectangle?
  4. What do you mean by the area of a Rectangle?
  5. Demonstration how to find area of a Rectangle.
  6. Define Heron’s Formula.
  7. How to calculate the area of a Rectangle?
  8. Main Logic to find the area of a Rectangle
  9. C program to find area of Rectangle
  10. Conclusion

What are the characteristics of quadrilateral?

The word Quadrilateral is derived from the two latin words quad and lateral which means four and sides respectively.  A Quadrilateral has four-sides, it is 2-dimensional (a flat shape), closed (the lines join up), and has straight sides.

What is a Rectangle?

A rectangle is a two-dimensional flat geometrical shape. A rectangle is a type of quadrilateral that has its parallel sides equal to each other. The two sides at each corner or vertex, meet at right angles. A rectangle ABCD has four sides as AB, BC, CD, and DA and right angles A, B, C, and D. The distance between A and B or C and D is defined as the length (l), whereas the distance between B and C or A and D is defined as Width (w) of the given rectangle.

What are the properties of the rectangle?

The properties of rectangle are given below:

  1. It has four sides and four vertices.
  2. Each vertex has angle equal to 90 degrees.
  3. The opposite sides are equal and parallel.
  4. Diagonal bisect each other.
  5. Perimeter is equal to twice of sum of its length and breadth.
  6. Area is equal to product of its length and breadth.
  7. It’s a parallelogram with four right angles.
  8. Sum of all interior angles equal to 360 degrees.

What do you mean by the area of a Rectangle?

The area of the triangle is the region enclosed by its perimeter or the four sides of the rectangle. A rectangle is characterized by length (l) and width (w). Both length and width are different in size.  In general, area of the rectangle is calculated by the formula:

A = l × w

Where, l is the length and w is width of the rectangle.

The standard unit for measurement of the area is m2.

Demonstration how to find area of a Rectangle:

rectangle Area

Main Logic to find the area of a triangle

  • Step 1: Input length and width of rectangle. Store it in two different variables say length and width.
  • Step 1: Apply formula to calculate rectangle area i.e. area = length × width.
  • Step 2: Finally, print the value of area.

C program to find area of rectangle

/**
 * C program to find area of rectangle
 */
#include <stdio.h>
int main()
{
    float length, width, area;
    /*
     * Input length and width of rectangle
     */
    printf("Enter length of the rectangle: ");
    scanf("%f", &length);
    printf("Enter width of the rectangle: ");
    scanf("%f", &width);
    /* Calculate area of rectangle */
    area = length * width;
    /* Print area of rectangle */
    printf("Area of the rectangle = %f sq. units ", area);
    return 0;
}

The output of the Program:

Area of rectangle Output

Conclusion

In this Program, User will enter the length and width of the rectangle into two variables length and width. Then, Calculate the Area of the rectangle using the formula Area = length × width. After the successful execution the final area of a rectangle is shown on screen.

    Please Login or Register to leave a response.

    Related Articles

    C Program Examples

    C Program to convert Decimal to Binary Number

    A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, ..

    C Program Examples

    C program to reverse a string

    This program reversed the entered string that means opposite of the previous string sequence...

    C Program Examples

    C program to reverse an Integer number

    Are you want a demonstration of The C Program that reverses an Integer number? This Program reversing the sequence of digits in an Integer. After the successful compilation of the program, a message..