Ask Question
23 June, 02:00

Write an algorithm that receives three numbers from the user and prints out the maximum of the three.

+5
Answers (1)
  1. 23 June, 03:11
    0
    Algorithm:

    1. Create three variables a, b, c.

    2. Read the value of a, b, c from user.

    3. Find maximum of a & b and assign it to m.

    4. Then find maximum of c & m and assign to maxx.

    5. Print maxx.

    Implementation In C++:

    #include

    using namespace std;

    int main ()

    {

    / / variables

    int a, b, c;

    cout<<"Enter three different numbers:";

    / / read value from user

    cin>>a>>b>>c;

    / / maximum of a & b

    int m = (a < b) ? b : a;

    / / maximum of m and c

    int maxx = (m < c) ? c : m;

    / / print maximum of all three

    cout<<"maximum of three number is:"<
    return 0;

    }

    Output:

    Enter three different numbers:12 4 15

    maximum of three number is:15
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write an algorithm that receives three numbers from the user and prints out the maximum of the three. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers