Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n, y, x;
- y = 0;
- cout << "n = ";
- cin >> n;
- while(n > 0){
- cout << "Introdu x: ";
- cin >> x;
- while(x % 2 == 0)
- x = x / 2;
- if(x == 1)
- y = y + 1;
- n = n - 1;
- }
- cout << "Y = " << y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment