Program to calculate area of different shape in C using switch statement
#include<stdio.h>
void main ()
{
int choice,r,l,b,base,h,area1,area2,area3;
clrscr();
printf ("\n you can perform following operation:");
printf ("\n 1. Area of circle:");
printf ("\n 2. Area of rectangle:");
printf ("\n 3. Area of parallelogram;");
printf ("\n Enter your choice:");
scanf ("%d", &choice);
switch ( choice )
{
case 1:
printf ("\n Enter value of radius:");
scanf ("%d", &r);
area1 = 3.14*(r*r);
printf ("%d", area1);
break;
case 2:
printf ("\n Enter value of length:");
scanf ("%d", &l);
printf ("\n Enter value of breadth:");
scanf ("%d", &b);
area2 = l*b;
printf ("%d", area2);
break;
case 3:
printf ("\n Enter value of base:");
scanf ("%d", &base);
printf ("\n Enter value of height:");
scanf ("%d", &h);
area3 = base*h;
printf ("%d", area3);
break;
default :
printf ("\n Invalid number:");
}
getch ();
}
Web Boundaries - Web Technology Articles >>>>> Download Now
ReplyDelete>>>>> Download Full
Web Boundaries - Web Technology Articles >>>>> Download LINK
>>>>> Download Now
Web Boundaries - Web Technology Articles >>>>> Download Full
>>>>> Download LINK Ww