forked from iot-lab-kiit/tasks.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq-3.cpp
More file actions
34 lines (33 loc) · 693 Bytes
/
q-3.cpp
File metadata and controls
34 lines (33 loc) · 693 Bytes
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
//program to find volume of a sphere, cylinder and cuboid using function overloading
#include<iostream>
using namespace std;
float vol(int,int);
float vol(float);
int vol(int,int,int);
int main()
{
int r,h,l,b,h1;
float r1;
cout<<"Enter radius and height of cylinder:";
cin>>r>>h;
cout<<"Enter length, breadth and height of cuboid:";
cin>>l>>b>>h1;
cout<<"Enter radius of sphere:";
cin>>r1;
cout<<"\nVolume of cylinder is"<<vol(r,h);
cout<<"\nVolume of cuboid is"<<vol(l,b,h1);
cout<<"\nVolume of sphere is"<<vol(r1);
return 0 ;
}
float vol(int r, int h)
{
return(3.14*r*r*h);
}
float vol(float r1)
{
return((4*3.14*r1*r1)/3);
}
int vol(int l, int b, int h1)
{
return(l*b*h1);
}