C program to find area of rectangle

Learn, how to find area of rectangle using C program?

Problem statement

Given length and breadth of a rectangle, write a C program to calculate area of the rectangle.

Calculating area of rectangle

To calculate the area of a rectangle, use the simple mathematical formula of rectangle area (length x breadth). Input length and breadth and then multiply these values which will be the area of a rectangle.

Area of rectangle program in c

/*C program to find area of a rectangle.*/
 
#include <stdio.h>
 
int main()
{
    float l,b,area;
 
    printf("Enter the value of length: ");
    scanf("%f",&l);
 
    printf("Enter the value of breadth: ");
    scanf("%f",&b);
 
    area=l*b;
 
    printf("Area of rectangle: %f\n",area);
     
    return 0;
}

Output

Enter the value of length: 1.25
Enter the value of breadth: 3.15
Area of rectangle: 3.937500

C Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.