Write a C program to enter length and breadth of a rectangle and find its perimeter.
Static program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int length=10,width=5,per;
per = 2*(length+width);
printf("The perimenter of rectangle is :- %d ",per);
getch();
}
Output :-
Dynamic Program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int length,width,per;
printf("Enter the length and breadth of a rectngle :-");
scanf("%d %d",&length,&width);
per = 2*(length+width);
printf("The perimeter of rectangle is :- %d",per);
getch();
}
Output :-