10 Mar 2013

Switch_AREA

/*

 Program to compute area of square, rectangle and circle....

*/

#include<stdio.h>

int main()
{
int a;
float l,b;
printf("\n******MENU*****");
printf("\n1.Square \n2.Rectangle \n3.Circle\n");
scanf("%d",&a);
switch(a)
{
case 1:  printf("\nenter square side :");
    scanf("%f",&l);
    printf("\nArea :%f",l*l);
    printf("\nPerimeter :%f",4*l);
    break;
case 2:  printf("\nenter length & breadth :");
    scanf("%f%f",&l,&b);
    printf("\nArea :%f",l*b);
    printf("\nPerimeter :%f",2*(l+b));
    break;
case 3:  printf("\nenter radius :");
    scanf("%f",&l);
    printf("\nArea :%f",3.14*l*l);
    printf("\nPerimeter :%f",2*3.14*l);
    break;
case 0: printf("\nWrong choice");
    break;
}
return 0;
}

Categories: ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger