Commeint setbits(unsigned int A)

{

int n,i,key,count;

key=1;

count=0;

for(i=0;i<=n;i++)

{

if(i==key)

{

count+1;

}

}

```
return count;
```

}

Commeint setbits(unsigned int A)

{

int n,i,key,count;

key=1;

count=0;

for(i=0;i<=n;i++)

{

if(i==key)

{

count+1;

}

}

```
return count;
```

}

bro you are supposed to find the number of 1 bits present in the bit representation of the given number. Your code will find number of 1s between 0 and n

convert A(number) into array of 0,1 i.e. binary representation;

then your method will be perfect.

while(A!=0)

{

A=A&A-1;

count++;

}