Tuesday, January 17, 2012

Area and Perimeter of Rectangle


#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,l,p;
clrscr();
printf(“enter the l and b value:\n”);
scanf(%f%f”,&l,&b);
a=l*b;
p=2*(l+b);
printf(“area=%f\n perimeter=%f\n”,a,p);
getch();
}


Output:
enter the l and b value:
6
8
area=48.000000
perimeter=28.000000 

No comments:

Post a Comment