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.

/* C Program To Calculate Perimeter & Area Of Rectangle*/
#include<stdio.h>
int main()
{
	int length, breadth, perimeter, area;

	printf("Enter length and breadth: ");
	scanf("%d%d", &length, &breadth);
	
	area = length*breadth;
	perimeter = 2 * (length + breadth);
	
	printf("Area is : %d",area);
	printf("\nPerimeter is : %d",perimeter);
	
	if (area>perimeter)
		printf("\nArea is greater than perimeter");
	else if (area<perimeter)
		printf("Area is lesser than perimeter");
	else
		printf("Area and perimeter are equal");

	return 0;
}

Output :
Enter length and breadth: 10
12
Area is : 120
Perimeter is : 44
Area is greater than perimeter



Leave a comment