-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmax_function.cpp
More file actions
34 lines (26 loc) · 499 Bytes
/
Copy pathmax_function.cpp
File metadata and controls
34 lines (26 loc) · 499 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
#include <iostream>
using namespace std;
// function declaration
int max(int num1, int num2);
int main()
{
// local variable declaration:
int a = 100;
int b = 200;
int ret;
// calling a function to get max value.
ret = max(a, b);
cout << "Max value is : " << ret << endl;
return 0;
}
// function returning the max between two numbers
int max(int num1, int num2)
{
// local variable declaration
int result;
if(num1 > num2)
result = num1;
else
result = num2;
return result;
}