How to calculate perimeter of a rectangle in C programming ?

C PROGRAM TO CALCULATE PERIMETER

                          OF A SQUARE

We know that the formula to find perimeter of a square is

                             [2*(l+b)]

_____________________________

#include<stdio.h>
int main()
{
int l,b,peri;
printf("Enter the length of the Rectangle:");
scanf("%d",&l);
printf("Enter the breadth of the Rectangle:");
scanf("%d",&b);
peri=2*(l+b);
printf("The Perimeter of the Rectangle=%d",peri);
return 0;
}

_____________________________


_____________________________

OUTPUT:- Enter the length of the Rectangle:12
                    Enter the breadth of the Rectangle:7
                    The Perimeter of the Rectangle=38

_____________________________


Thank you all -----

Follow my blog for more programming knowledge...

------------------x----------------------x-------------------------x------------------

Comments

Popular Posts