C Programming Code Examples C > Beginners Lab Assignments Code Examples C program to find area of a rectangle C program to find area of a rectangle Write a C program to input length and width of a rectangle and find area of the given rectangle. How to calculate area of a rectangle in C programming. Input length and width of rectangle. Store it in two different variables say length and width. Apply formula to calculate rectangle area i.e. area = length * width. Finally, print the value of area. #include <stdio.h> int main() { float length, width, area; /* * Input length and width of rectangle */ printf("Enter length of rectangle: "); scanf("%f", &length); printf("Enter width of rectangle: "); scanf("%d", &width); /* Calculate area of rectangle */ area = length * width; /* Print area of rectangle */ printf("Area of rectangle = %f sq. units ", area); return 0; }