-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathques 2.cpp
More file actions
executable file
·38 lines (38 loc) · 1.19 KB
/
Copy pathques 2.cpp
File metadata and controls
executable file
·38 lines (38 loc) · 1.19 KB
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
#include <iostream>
#include <stdlib.h>
#include <math.h>
jju dj{
int choice ;
float a , l , b , r , s1 , s2 , s3 , s ;
float area ;
float pi = 3.14 ;
std::cout << "Enter your choice . Area of :"<< std::endl;
std::cout << "1.Rectangle"<< std::endl;
std::cout << "2.Circle"<< std::endl;
std::cout << "3.Triangle"<< std::endl;
std::cin >> choice ;
if (choice = '1')
{ std::cout << "enter length of the rectangle :"<< std::endl;
std::cin >> l;
std::cout << "enter breadth of the rectangle :"<< std::endl;
std::cin >> b;
area = l * b;
std::cout << "Area of the rectangle = "<< area << " sq. units " << std::endl;
}
else if (choice = '2' )
{ std::cout << "Enter radius of circle " << std::endl;
std::cin >> r ;
area = pi * r * r ;
std::cout << "Area of the circle= " << area << " sq. units" << std::endl;
}
else if (choice = '3' )
{ std::cout << "Enter length of three sides of the triangle :" << std::endl;
std::cin >> s1 >> s2 >>s3 ;
s = ( s1 + s2 + s3) / 2 ;
a=sqrt ( s * ( s - s1 ) * ( s - s2 ) * ( s - s3 ));
std::cout << "Area of the triangle= " << area << " sq. units " << std::endl;
}
else
{ std::cout << "Invalid choice !" << std::endl;
}
}