fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,i,count;
  6.  
  7. while(1){
  8. cin>>n;
  9. count=0;
  10. if(n==0)
  11. return 0;
  12. while(n>1){
  13. n=n/2;
  14. count++;
  15.  
  16. }
  17. cout<<count<<endl;
  18. }
  19.  
  20. // your code goes here
  21. return 0;
  22. }
Success #stdin #stdout 0s 3416KB
stdin
1
5
3
0
stdout
0
2
1