Pages

Thursday, October 21, 2010

AREA

Compute the area and circumference of the largest circle which can be out form a square metal sheet in which the edge or length is entered. Compute also the area of the wasted materials.


#include<stdio.h>
#include<conio.h>

int main(void)
{
    float L, rad, AreaSquare, AreaCircle, CircumC, AreaWaste;

    clrscr();
    printf("\n\n\tEnter the length/edge of the square metal sheet:");
    scanf("%f",&L);

    rad =L/2;
    AreaSquare =L*L;
    AreaCircle =(rad*rad)*3.1416;
    AreaWaste =AreaSquare-AreaCircle;
    CircumC =(rad*3.1416)*2;

    printf("\n\n\tThe circumference of the largest circle: %.2f",CircumC);
    printf("\n\n\tThe area of the largest circle: %.2f square units",AreaCircle);
    printf("\n\n\tThe area of the wasted materials: %.2f square units",AreaWaste);
    getch();
}

No comments:

Post a Comment