The length and breadth / width of a rectangle are entered through the keyboard. Write a program to calculate the area of the rectangle.
Rectangle is a quadrilateral(i.e., it has 4 sides). And all the 4 angles of the rectangle are of 90 degree. To calculate area of a rectangle we need its length and width/breadth.
Related Read:
Basic Arithmetic Operations In C
Perimeter of Rectangle: C Program
Note: Area of a Rectangle is calculated using the formula
Area = Length * Width;
Length: is the length of the longest side of the rectangle.
width: is the length of the smallest side of the rectangle.
Find Area of a Rectangle: C Program
[youtube https://www.youtube.com/watch?v=yvgxG0hGqsY]
Source Code: Find Area of a Rectangle: C Program
#include < stdio.h > int main() { float length, width, area; printf("Enter length of rectangle\n"); scanf("%f", &length); printf("Enter width of rectangle\n"); scanf("%f", &width); area = length * width; printf("Area of Rectangle is %f\n", area); return 0; }
Output:
Enter length of rectangle
12
Enter width of rectangle
6
Area of Rectangle is 72.000000
For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert