C programming
int main()
{
float l,b,area,perimeter;
printf("Enter length of Rectangle : ");
scanf("%f",&l);
printf("Enter breadth of Rectangle: ");
scanf("%f",&b);
area=l*b;
printf("Area of rectangle : %0.4f\n",area);
perimeter=2*(l+b);
printf("Perimeter of rectangle: %0.3f\n",perimeter);
return 0;
}
Try it Yourself ➠
Area and Perimeter of Rectangle in C
26 July
0
Write a program (WAP) in C to calculate Area and Perimeter of rectangle.
#include <stdio.h>int main()
{
float l,b,area,perimeter;
printf("Enter length of Rectangle : ");
scanf("%f",&l);
printf("Enter breadth of Rectangle: ");
scanf("%f",&b);
area=l*b;
printf("Area of rectangle : %0.4f\n",area);
perimeter=2*(l+b);
printf("Perimeter of rectangle: %0.3f\n",perimeter);
return 0;
}
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment