adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <queue>
    using namespace std;
    int main ()
    {
        queue<int> myqueue;
        int sum (0);
        for (int i = 1; i <= 10; i++) 
            myqueue.push(i);
        while (!myqueue.empty())
        {
            sum += myqueue.front();
            myqueue.pop();
        }
        cout << sum << endl;
        return 0;
    }

a.

51

b.

52

c.

54

d.

55

Answer: (d).55

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?