Stock span problem

my code is not giving any output ,
logic seems to be correct .
please check what are the bugs

There are two mistakes in your code:

  1. You are not taking input of value of n (cin>>n).
  2. Where is the โ€˜elseโ€™ to the first โ€˜ifโ€™ in you function stockspan.

Please feel free to ask any doubts here, but try debugging your codes yourself. We would love to debug them for you, but it will only deprive you of the satisfaction, and experience you gain by debugging your own codes.

1 Like

ooh my bad . i was not taking input n and loop was running on garbage n in main function