Programming

Write a program to find the minimum value among the inputs given. Your program should contain two functions with return types as int min (int, int); and int min (int, int, int); i.e. the first function takes two arguments and the second one three.

Source Code

```#include<iostream.h>
#include<conio.h>
int min(int, int);
void main()
{
int a,b,c,d;
cout<<"Enter Number:";
cin>>a>>b>>c>>d;
cout<<"Minimum no="<<min(min(a,b),min(c,d));
getch();
}
int min(int j, int k)
{
return((j<k)?j:k);
}```
Output:
```Enter Number:3
4
5
6
Minimum no=3```

Source Code

```#include<iostream.h>
#include<conio.h>
int min(int, int, int);
void main()
{
int a,b,c,d,e,f;
cout<<"Enter Number:";
cin>>a>>b>>c>>d>>e>>f;
cout<<"Minimum no="<<min(min(a,b),min(c,d),min(e,f));
getch();
}
int min(int j, int k, int l)
{
if(j<k && k<l && l<j)
return j,k,l;
}```

Output:

```Enter Number:3
4
5
6
5
6
Minimum no=3```

#### Tuts

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

## You may also like

Programming

Programming

#### Calculate the Factorial by Using Recursion

• January 26, 2016