Counting set bits

again the same problem I am receiving my code runs perfectly fine in another compiler and i am getting desired output but in this course ide error and error… I am having this problem in almost every question so please tell me once why i am getting error and the compiler is not accepting my response.
because I am losing my confidence and i have to unlock all editorial also and I am losing my points

please help me ASAP

#include
using namespace std;
int main() {

int n;
cin>>n;
while(n--){
	int no;
	cin>>no;
	int ans=0;
	while(n>0){
		n=n&(n-1);
		ans++;
	}
	cout<<ans;
}

return 0;

}

@neelmani98
You are taking input as “no” and then counting bits for N ( number of test cases )

If your doubt is resolved please mark it as closed.