Prateek sir and coding

I created a solution for that problem but my test cases are fails could you please help?

This is code: #include #include #include #include #include #include using namespace std; /* Sample Input 7 2 73 2 83 2 43 1 1 2 16 2 48 Sample Output 43 83 */ int main(){ int n; cin>>n; stack s; while(n–) { int query_type,no; cin>>query_type; if(query_type == 2) { cin>>no; s.push(no); } else if(query_type == 1) { if(s.empty()) { cout<<“No Code”; } else{ cout<<s.top()<<endl; s.pop(); } } } return 0; }

hi @meetsoni01041996,
could u pls share ur code using ide.codingblocks.com.

yeah sure wait a moment

''https://ide.codingblocks.com/s/185759"""

Sorry for a little late reply :sweat_smile:
Just put an endl after No code i.e cout<<“No Code”<<endl;
U will get correct answer.

Ohh shit !! i just forgot to put endl

thank you so much

1 Like

Hi, if ur doubt was resolved , please mark it resolved
else if u still have any doubt regarding dis question, u can post it here : )