-
Notifications
You must be signed in to change notification settings - Fork 0
/
Areas.c
41 lines (40 loc) · 830 Bytes
/
Areas.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<stdio.h>
int main()
{
int a,b,ch;
float area;
while (ch!=4)
{
printf("Program to Compute Areas \n");
printf("1. Rectangle \n");
printf("2. Circle \n");
printf("3. Triangle \n");
printf("4. Exit \n");
printf("Enter Choice: \n");
scanf("%d",&ch);
switch(ch)
{
case 1: printf("Enter length and breadth of rectangle \n");
scanf("%d%d",&a,&b);
area = a*b;
printf("Area Of Rectangle Is : %f", area);
break;
case 2: printf("Enter radius of circle \n");
scanf("%d",&a);
area = 3.14*a*a;
printf("Area Of Square Is : %f", area);
break;
case 3: printf("Enter length of base and height of triangle \n");
scanf("%d %d",&a,&b);
area = 0.5*a*b;
printf("Area of triangle is : %f", area);
break;
case 4: printf("Thank You \n");
break;
default: printf("Wrong Entry \n Enter Again \n");
break;
}
printf("\n");
}
return 0;
}