Ask Question
10 April, 04:02

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

+4
Answers (1)
  1. 10 April, 07:21
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers