Answer to Question #252762 in C++ for pablo

Question #252762

Devise the algorithm for the following and verify whether they satisfy all the features.

1.An algorithm that inputs three numbers and outputs them in ascending order.

2.To test whether the three numbers represent the sides of a right angle triangle.

3.To test whether a given point p (x,y) lies on x-axis or y-axis .

4.To compute the area of a circle of a given circumference

5.To locate a specific word in a dictionary



1
Expert's answer
2021-10-18T00:14:32-0400
#include <iostream>


using namespace std;


int main()
{
    double n1;
    cout<<"\nEnter first number: ";
    cin>>n1;
    double n2;
    cout<<"\nEnter second number: ";
    cin>>n2;
    double n3;
    cout<<"\nEnter third number: ";
    cin>>n3;


    if (n1<n2 && n3<n2){
        if (n1 > n3)
            cout<<n3<<" "<<n1<<" "<<n2;
        else
            cout<<n1<<" "<<n3<<" "<<n2;
    }
        
    else if (n1 < n3 && n2 < n3){
        if (n1 > n2)
            cout<<n2<<" "<<n1<<" "<<n3;
        else
            cout<<n1<<" "<<n2<<" "<<n3;
    }
        
    else if (n2 < n1 && n3 < n1){
        if (n3 > n2)
            cout<<n2<<" "<<n3<<" "<<n1;
        else
            cout<<n3<<" "<<n2<<" "<<n1;
    }
       
    else
        cout<<n1<<" "<<n2<<" "<<n3;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS