Hint: The area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter.
Perimeter of rectangle = 2* (length + breadth)
Area of rectangle = length * breadth
#include<conio.h>
int main()
{
int length,breadth,perimeter,area;
printf("enter length and breadth: ");
scanf("%d%d",&length,&breadth);
perimeter=2*(length+breadth);
area=length*breadth;
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");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
Perimeter of rectangle = 2* (length + breadth)
Area of rectangle = length * breadth
Code
#include<stdio.h>#include<conio.h>
int main()
{
int length,breadth,perimeter,area;
printf("enter length and breadth: ");
scanf("%d%d",&length,&breadth);
perimeter=2*(length+breadth);
area=length*breadth;
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");
printf ("\n\nPress any key to close.");
getch ();
return 0;
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.