YOC already wrote an article about a program to find biggest among given three numbers. Here we find smallest among given three numbers. The logic is just opposite, that is every greater than symbol (>) is replaced with less than (<) symbol and all remaining codes are same.

As we read three solutions on finding largest among three numbers, this program has three or more solutions for getting smallest number. Code explanation is similar to the code explanation of finding biggest number.

Solution 1:

```#include <iostream>
using namespace std;
int main()
{
int a,b,c,smallest;
cout << "Enter three numbers :";
cin>>a>>b>>c;
if(a<b && a<c)
cout<<"smallest is "<<a;
else if(b<a && b<c)
cout<<"smallest is "<<b;
else
cout<<"Smallest number is "<< c;
return 0;
}
```

Solution 2:

```#include <iostream>
using namespace std;
int main()
{
int a,b,c,smallest;
cout << "Type any three numbers :";
cin>>a>>b>>c;
if(a<b)
{
if(a<c)
smallest = a;
else
smallest = c;
}
else if(b<c)
smallest = b;
else
smallest = c;
cout<<"Smallest number is "<< smallest;
return 0;
}
```

Solution 3:

```#include <iostream>
using namespace std;
int main()
{
int a,b,c,smallest;
cout << "Enter any three numbers :";
cin>>a>>b>>c;
smallest = a;
if(b<smallest)
smallest = b;
if(c<smallest)
smallest = c;
cout<<"Smallest number is "<< smallest;
return 0;
}
```

Sample Output:

## One Comment

1. erjilo pterin 26th May 2020

I’m still learning from you, while I’m improving myself. I absolutely liked reading everything that is written on your website.Keep the information coming. I liked it!