Text: |
ԲΠ= Ãîðáà÷åíêî Â.À.
Çàïèòàííÿ:/*
Ïðîãðàìà ç÷èòóº ÷èñëî ç êëàâ³àòóðè
³ âèâîäèòü íà åêðàí ê³ëüê³ñòü á³ò³â, ÿê³ äîð³âíþþòü îäèíèö³ â äâ³éêîâîìó êîä³
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main(){
cout<<" Enter X [ X >= 0 ] : ";
unsigned long x=0,count=0;
cin>>x;
while (x!=0){
if (x & 01) count++;
x=x>>1;
}
cout<<"The count '1' is "<<count<<endl;
system("PAUSE");
}
====================================
|