write a C program to find area and perimeter of a rectangle
Answers
Answered by
0
Answer:
/*for Area*/
#include<studio.h>
void main()
{
float X,y,A;
printf ("enter the length and width of rectangle");
scanf ("%f%f",&x,&y);
A=X*y;
prinf ("%f is the Area of rectangle",A);
}
/*for perimeter*/
#include<studio.h>
void main()
{
float X,y,p;
printf ("enter the length and width of rectangle");
scanf ("%f%f",&x,&y);
A=X+y;
prinf ("%f is the perimeter of rectangle",p);
}
Answered by
2
Answer:
#include<constream.h>
void main ();
{
clrscr();
float l, b, area, peri;
cout<<"\nEnter length:";
cin>>l;
cout<<"\nEnter width:";
cin>>b;
peri=2*(l+b);
area=l*b;
cout<<"\nPerimeter="<<peri;
cout<<"\nArea="<<area;
getch();
}
Similar questions