Programming

# C – Find the Area of Triangle, Circle and Square Using Switch Case

C Program to find the area of triangle, circle and square using switch case.

`#include<stdio.h>#include<conio.h>#include<math.h>void main(){ int choice; clrscr(); printf("1. For are of triangle"); printf("2. For area of circle"); printf("3. For area of ractangle"); printf("4. For are of square"); printf(" Enter your choice:n"); scanf("%d",choice); { case 1:   {    int b,h,a;    printf("Enter base and height:");   scanf("%d%d",&b,&h);   a=(b*h)/2;   printf("The aree of triangle=%d",a);   break;   } case 2:   {    float r,a;   printf("Enter readius");   scanf("%g",&r);   a=3.14594*r*r;   printf("n area of circle=%g",a);   break;  } case 3:   {   int l,b,a;   printf("Enter lenght and breadth:");   scanf("%d%d",&l, &b);   a=l*b;   printf("Area of rectangle:%dn",a);   break;   } case 4:   {   int a,b;    printf("Enter lenght");   scanf("%d",&a);   b=a*a;   printf("The are of square:%d",b);   break;  } default:  {   printf("Wrong Choice"); } getch();}`

#### Tuts

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

## You may also like

Programming

Programming

#### Calculate the Factorial by Using Recursion

• January 26, 2016