C Program to Calculate Area & Perimeter of the Rectangle

#include<stdio.h>
#include<conio.h>

int main()
{
    /* Declaring variables */
    float length, breadth, area, perimeter;

    /* Reading length and breadth from user */
    printf("Enter length of the rectangle = ");
    scanf("%f", &length);
    printf("Enter breadth of the rectangle = ");
    scanf("%f", &breadth);

    /* Calculating area and perimeter */
    area = length * breadth;
    perimeter = 2 * (length * breadth);

    /* Displaying result */
    printf("Area of rectangle = %f", area);
    printf("\nPerimeter of rectangle = %f", perimeter);

    return 0;

Output

Enter length of the rectangle = 23
Enter breadth of the rectangle = 17
Area of rectangle = 391.000000
Perimeter of rectangle = 782.000000

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.