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 

  1. Write a program to input two number and print their addition. 
  2. Write a program to input two number and print their subtraction. 
  3. Write a program to input two number and print their multiplication. 

Comments

Popular posts from this blog

Write a program to input age of any person and check he is eligible for voting or not.

Write a program to input two digit number and check number is palindrome or not.

Write a program to check age of any student is teen age or not.