max power in beginner that’s my solution for max 2 question when i passed any no of 0 in value n that give me 0 my ans is correct but i don’t why it give me 0 because i used the login when n will find the continue 0 in that then increase the counter variable.when it find 1 than it will break from the loop.can any one help me???
#include
using namespace std;
int main() {
// your code goes here
int n,count=0;
cin>>n;
string x;
cin>>x;
for(int i=n-1;i>=0;i–)
{
if(x[i]==‘0’)
count++;
else
break;
}
cout<<count<<endl;
return 0;
}