C program to calculate area and perimeter of a rectangle with given parameters

# include< stdio.h >
# include< conio.h >
void main ()
{
           float l, b, a, peri;
           clrscr();
           printf(" Enter the length and breadth of the rectangle : ");
           scanf("\n%f\n%f",&l,&b);
           a = l * b;
           peri = 2* (l + b);
           printf(" The area of rectangle is= %f and its perimeter is = %f",a, peri);
           getch();
}

OUTPUT :

Enter the length and breadth of the rectangle :
5
4
The area of rectangle is= 20 and its perimeter is = 18

No comments :

Post a Comment