Source Code:
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter three integers: "<<endl;
cin>>a>>b>>c;
if(a<b)
{
if(a<c)
{
cout<<"The smallest number is: "<<a;
}
else
{
cout<<"The smallest number is: "<<c;
}
}
else
{
if(b<c)
{
cout<<"The smallest number is: "<<b;
}
else
{
cout<<"The smallest number is: "<<c;
}
}
return 0;
}
Program Output:
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter three integers: "<<endl;
cin>>a>>b>>c;
if(a<b)
{
if(a<c)
{
cout<<"The smallest number is: "<<a;
}
else
{
cout<<"The smallest number is: "<<c;
}
}
else
{
if(b<c)
{
cout<<"The smallest number is: "<<b;
}
else
{
cout<<"The smallest number is: "<<c;
}
}
return 0;
}
Program Output:
No comments:
Post a Comment