We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here you did not give the break loop condition for the first while loop.
so it will take input till N and store it in array of size N after that it will again take the value and put it in buffer which no means. and if u enter any charachter then it will exit from the loop because here type is integer.
break condition: while(std::cin>>A[i++] && i
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
Here you did not give the break loop condition for the first while loop. so it will take input till N and store it in array of size N after that it will again take the value and put it in buffer which no means. and if u enter any charachter then it will exit from the loop because here type is integer. break condition: while(std::cin>>A[i++] && i