Wednesday, 8 July 2015

Ascending or descending Order in C++

#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"enter a three numbers:"<<endl;
cin>>a>>b>>c;
if(a<b || b<c){

cout<<"numbers in ascending order:\n\n";
cout<<a<<"\t"<<b<<"\t"<<c;

}else
if(b<a || a<c){

cout<<"numbers in ascending order:\n\n";
cout<<b<<"\t"<<a<<"\t"<<c;


}else
if(c<b || b<a){

cout<<"numbers in ascending order:\n\n";
cout<<c<<"\t"<<b<<"\t"<<a;
}

}

0 comments:

Post a Comment