In: Computer Science
Write a c++ code that prompts the user to enter three float numbers and print them in acsending order
#include <iostream>
using namespace std;
int main()
{
float a,b,c;
cout<<"Enter three float number: ";
cin>>a>>b>>c;
if((a>=b)&&(a>=c))
{
if(b>=c)
{
cout<<"\n Ascending order :"<<c<<"
"<<b<<" "<<a;
}
else
{
cout<<"\n Ascending order :"<<b<<"
"<<c<<" "<<a;
}
}
else if((b>=a)&&(b>=c))
{
if(a>=c)
{
cout<<"\n Ascending order :"<<c<<"
"<<a<<" "<<b;
}
else
{
cout<<"\n Ascending order :"<<a<<"
"<<c<<" "<<b;
}
}
else if((c>=a)&&(c>=b))
{
if(a>=b)
{
cout<<"\n Ascending order :"<<b<<"
"<<a<<" "<<c;
}
else
{
cout<<"\n Ascending order : "<<a<<"
"<<b<<" "<<c;
}
}
return 0;
}