C Program to Calculate Area of Rectangle

C Program to calculate area of rectangle. This is programs for beginners in c programming to understand the advanced concepts in c. The formula for calculating the area of a rectangle. Rectangle surface area A is equal to l * b. Once the length and width of a rectangle are known, the area is calculated. The area of a rectangle can be calculated by multiplying its length and width.

#include<stdio.h>
int main()
{
float length, breadth, area;
printf("Enter length of Rectangle");
scanf("%f", &length);
printf("Enter breadth of Rectangle");
scanf("%f", &breadth);
area = length*breadth;
printf("\nArea = %0.2f", area);
return 0;
}

 

Output:

Enter length of Rectangle

45

Enter breadth of Rectangle

45

Area = 2025.00

Length and Breadth in C Program

Length is a unit of measurement for distance. Length is a quantity with the dimension distance in the International System of Quantities. When length is the longest dimension, width or breadth are usually used to refer to a shorter dimension. Depth is the name given to the third dimension of a three-dimensional object. The definition of breadth refers to something’s width or how far something extends.

A rectangle has two sides: length (L) and width (W). A rectangle’s length is its longest side, while its width is its shortest. The width of a rectangle is also known as its breadth (b).

Float Data Type in C

A float is a data type in computer science that is composed of a number that is not an integer because it includes a fraction represented in decimal format. Some argue that the float data type is used in computer programming when more precision than integers can provide is required. 

The term floating point refers to the fact that the radix point (decimal point, or, more commonly in computers, binary point) of a number can “float”; that is, it can be placed anywhere relative to the number’s significant digits. Using this program we can execute the c program to calculate area of rectangle.