Anda di halaman 1dari 2

Ascending Number

Program

#include <iostream>
using namespace std;
int main()

{
int first,second,third;
cout<<"This program will output the numbers you entered in ascending
order."<<endl;
cout<<"Enter the numbers..."<<endl;
cout<<" "<<endl;
cout<<"Enter the First Number: ";
cin>>first;
cout<<" "<<endl;
cout<<"Enter the Second Number: ";
cin>>second;
cout<<" "<<endl;
cout<<"Enter the Third Number: ";
cin>>third;

if (first>second && second>third)


cout<<third<<" "<<second<<" "<<first;

else if (first>third && third>second)


cout<<second<<" "<<third<<" "<<first;

else if (second>first && first>second)


cout<<third<<" "<<first<<" "<<second;

else if (second>third && third>first)


cout<<first<<" "<<third<<" "<<second;

else if (third>first && first>second)


cout<<second<<" "<<first<<" "<<third;

else cout<<first<<" "<<second<<" "<<third;

return 0;
}
Test

Anda mungkin juga menyukai