To calculate area and parameter of rectangle,and area and circumference of circle
The lenght and breadth of a rectangle and radius of a circle are input through the keyboard.Write a program to calculate the area and parameter of the rectangle,and the area and circumference of the circle
.
#include
#include
void main(void)
{
float cc,rc,ac,wr,lr,ar,pr;
printf(“Enter the radius of circle,lenght and width of rectangle:”);
scanf(“%f%f%f”,&rc,&lr,&wr);
cc=2*3.14*rc;
pr=2*lr+2*wr;
ac=2*3.14*rc*rc;
ar=lr*wr;
printf(“The area of circle is %.2f,circumference is %.2f,\narea of rectangle is %.2f \nand perimeter is %.2f”,ac,cc,ar,pr);
getch();
}
Comments
Post a Comment