Online C++ Compiler

#include <iostream> #include <stack> using namespace std; int main() { stack<int> stck; int Product = 1; stck.push(1); stck.push(2); stck.push(3); stck.push(4); stck.push(5); stck.push(6); cout<<"size of stack is: "<<stck.size(); while (stck.size()>0) { Product = Product * stck.top(); stck.pop(); } cout<<"\nProduct of elements in stack are: "<<Product; return 0; }