Write a program to find the smallest among 3 numbers

//this is a program to find the smallest among 3 numbers
#include<iostream>
#include<conio.h>

 using namespace std;

 int main()
 {
int num1,num2,num3;

cout<<"\n\nEnter any 3 numbers: ";
cin>>num1>>num2>>num3;

if(num1<num2)
{
if(num1<num3)
cout<<"\n\nThe number "<<num1<<" is a smallest number.";
else
cout<<"\n\nThe number "<<num3<<" is a smallest number.";
}
else
{
if(num2<num3)
cout<<"\n\nThe number "<<num2<<" is a smallest number.";
else
cout<<"\n\nThe number "<<num3<<" is a smallest number.";
}
return 0;
getch();
 }

Previous
Next Post »