Q9 Given the length and breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length=5 and breadth=4 is greater than its perimeter.

Given the length and breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter.

Program: 77

Given the length and breadth of a rectangle, write a c program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter.

#include<stdio.h>
#include<conio.h>
int main()
{
    float length, breadth, area, perimeter;

    printf("Enter the length of rectangle: ");
    scanf("%f", &length);

    printf("Enter the breadth of rectangle: ");
    scanf("%f", & breadth);

    area = length * breadth;
    perimeter = 2 * (length+breadth);

    printf("The area of rectangle: %f\n", area);
    printf("The perimeter of rectangle: %f\n", perimeter);

    if (area>perimeter)
        printf("Area of rectangle is greater than it's perimeter");
    else
        printf("Perimeter of rectangle is greater than it's area");
}

Output:

 Enter the length of rectangle: 4
 Enter the breadth of rectangle: 5
 The area of rectangle: 20.000000
 The perimeter of rectangle: 18.000000
 Area of rectangle is greater than it's perimeter

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.