4/25/21

C Program to Find Area and Perimeter of Rectangle

C Program to Find Area and Perimeter of a Given Length and Breadth

#include<stdio.h>

void main ()

{

float l,b,area,peri;

printf("Enter length breadth of rectangle=");

scanf("%f%f",&l,&b);

area=l*b;

peri=2*(l+b);

printf("Area is=%f",area);

printf("\nperimenter is=%f",peri);

if (area<=peri)

        printf("\nPerimeter is greater than area");

else

printf("\nArea is greater than perimeter");

getch();

}

Output:-

Explanation:- 

 In this program first, we have accepted input from the user (length and breadth). After that we put the formula of area and perimeter of rectangle into it. After that program gives the area and perimeter of rectangle as output. Then we compare the area and perimeter to check the which one of these are greatest. 

0 comments:

Post a Comment

Like us on facebook

blogger templatesblogger widgets

Follow on Twitter

Linkedin

Categories

Contact Form

Name

Email *

Message *

Mad About Computer. Powered by Blogger.