Answers for "sum of stack c++"

C++
1

sum of stack c++

stack<int> si;
    int sum = 0;
    stack<int> tsi(si);
    while (!tsi.empty()) {
        sum += tsi.top();
        tsi.pop();
    }
Posted by: Guest on August-20-2020

Browse Popular Code Answers by Language