Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,325 views

Image of Question :: 

image

in Online Assessments by Expert (108,690 points)
edited by | 1,325 views

1 Answer

0 like 0 dislike
Best answer

C++ Code Solution :: 

 

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll ; 
/* Function to check if x is power of 2*/
bool kk(long long int n)
{
    if (n == 0)
        return 0;
    if ((n & (~(n - 1))) == n)
        return 1;
    return 0;
}
int main() {
    
    ll n ;
    cin>>n ;ll gg = 0 ; 
    ll i = 1 ; 
    while(i<=n){
        ll yy;
        cin>>yy;
        if(yy==0){
            
        } else if(kk(yy)==true) {
            
        } else {
            gg++;
        }
        
        i++;
    }
    cout<<gg ; 
    
    
    
    
    return 0 ; 
}
by Expert (108,690 points)