CapitalIQ Interview Question
Software Engineer / Developers<pre lang="" line="1" title="CodeMonkey82019" class="run-this">/* The class name doesn't have to be Main, as long as the class is not public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
String s;
while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
}
}
class abc
{
while(x!=0)
{count++;
x=x&(x-1);
}
System.out.println(count);
}
</pre><pre title="CodeMonkey82019" input="yes">
a</pre>
while(x!=0)
- Anonymous August 20, 2009{count++;
x=x&(x-1);
}
count is the number of 1's