-
Notifications
You must be signed in to change notification settings - Fork 0
/
functionprog.cpp
53 lines (51 loc) · 1.02 KB
/
functionprog.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
//Define two functions to print the maximum and the minimum number respectively among three numbers entered by user.
#include<iostream>
#include<conio.h>
using namespace std;
int max(int a,int b,int c)
{
if (a>b and a>c)
{
cout<<"first no. is greater "<<a;
}
if (b>c and b>a)
{
cout<<"second no. is greater "<<b;
}
if(c>a and c>b)
{
cout<<"third no. is greter "<<c;
}
return 0;
}
int min(int a,int b,int c)
{
if (a<b and a<c)
{
cout<<"first no. is smaller "<<a;
}
if (b<c and b<a)
{
cout<<"second no. is smaller "<<b;
}
if(c<a and c<b)
{
cout<<"third no. is smaller "<<c;
}
return 0;
}
int main()
{
int a,b,c;
cout<<"Enter your first no. ";
cin>>a;
cout<<"Enter your second no. ";
cin>>b;
cout<<"Enter your third no. ";
cin>>c;
max(a,b,c);
cout<<"\n";
min(a,b,c);
return 0;
getch();
}