Program to input length and width of a rectangle and print their area and perimeter in C.
In this program we input length and width of a rectangle and print Area and Perimeter.
1st we input two number as length and width , after then we use Area and Perimeter formula in program logic. At last we print Area and Perimeter as Output.
/*Program to calculate area and perimeter of rectangle*/
#include<stdio.h>
#include<conio.h>
void main()
{
int l,w,a=0,p=0;
clrscr();
printf("Enter length=");
scanf("%d",&l);
printf("Enter width=");
scanf("%d",&w);
a=l*w;
p=2*(l+b);
printf("Area=%d",a);
printf("\nPerimeter=%d",p);
getch();
}
OUTPUT
If any problems or suggestions in program please comment and share your programmer friends.
Follow for recently updates.
Related Examples
1st we input two number as length and width , after then we use Area and Perimeter formula in program logic. At last we print Area and Perimeter as Output.
/*Program to calculate area and perimeter of rectangle*/
#include<stdio.h>
#include<conio.h>
void main()
{
int l,w,a=0,p=0;
clrscr();
printf("Enter length=");
scanf("%d",&l);
printf("Enter width=");
scanf("%d",&w);
a=l*w;
p=2*(l+b);
printf("Area=%d",a);
printf("\nPerimeter=%d",p);
getch();
}
OUTPUT
If any problems or suggestions in program please comment and share your programmer friends.
Follow for recently updates.
Related Examples

Comments
Post a Comment