answersLogoWhite

0

1. Find algorithm.

2. Implement it.

Hint: if a non-zero N number has K 1-bits, then (N AND N-1) has K-1 1-bits.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Write an 8086 assembly language program Which count the numbers of characters in the string s1 where s1 equals i know assembly programming?

Here’s a simple 8086 assembly language program to count the characters in the string "i know assembly programming": section .data s1 db 'i know assembly programming', 0 ; String with null terminator count db 0 ; To store the character count section .text global _start _start: mov si, s1 ; Load address of the string into SI xor cx, cx ; Clear CX for counting characters count_loop: cmp byte [si], 0 ; Check for null terminator je done ; If found, jump to done inc cx ; Increment character count inc si ; Move to the next character jmp count_loop ; Repeat the loop done: mov count, cl ; Store the count in 'count' ; Further code to exit or display the count can go here This program initializes a string and counts the characters until it encounters the null terminator, storing the final count in a variable.


What does sql count usually refer to?

The acronym SQL stands for Specialized Query Language. It is a specialized computer language for handling databases. When someone refers to an SQL count, it means to use this program language to either horizontally or vertically count the number of rows in a piece of data. This feature could be used to count the number of names of people in a digital phone book, for instance.


Program to count the number of characters and words in the line?

in linux wc -l filename will count the lines and wc will count the letters


It 4-1 solved question papers November -2008?

Write a program to count the number of IS in any number in register B and put the count in R5.


What is the program counter?

Counters in basic are used to count a number of times a process is being used.


How do you count the number of objects available in a program in c?

Use ordinal numbers: 0, 1, 2, ...


Write a program to get table of a number?

#include "stdio.h" #include "conio.h" #define TABLE_UP_TO_20 20 void table_of_a_number(int number); int main() { int i = 0x00; printf("Enter a positive number in decimal whose table has to be generated"); scanf("%d",&i); table_of_a_number(i); return 0; } void table_of_a_number(int number) { int count = 0x00; for(count = 0x01;count <=TABLE_UP_TO_20 ;count++) { /* THis will print the table*/ printf(" %d * %d = %d\n", number,count, (number*count)); }


Write a program that ask the user to enter a number n and display the first n even numbers?

#include "stdio.h" int main() { unsigned int number, count; printf("Enter the Number \t"); scanf("%d", &number); printf("The even numbers are: \n"); for(count = 0x01; (count < number && number!= 0x00)) { if(count%2) { }else { printf("%d\n", count); } count++; } return 0; }


Write a program using while loop?

//program to find the factorial value f any number using while loop #include<stdio.h> void main() { int i,n,fact=1; printf("Enter the number\n"); scanf("%d",&n); i=n; while (i>=1) { fact=fact*i; i--; } printf("The factorial value=%d",fact); } the above is a program for calculating tha factorial value of any number which is entered by the user


How to make your program select a number from a range in BASIC?

PROGRAMMING LANGUAGE: QBASIC/VERSION 1.1 CLS '*** (CL)ear the (S)creen FOR eachNum%=1 TO 10 IF eachNum%=5 THEN PRINT "five"; '*** print number as being alphabet letters ELSE PRINT eachNum% '*** print number as being a numerical figure END IF NEXT This FOR/NEXT loop will count up from 1 TO 10; each time printing out the number count that it has currently reached up to. However, we use an IF/THEN/ELSE select statement to say that when the count reaches 5, then, print out 5 not as a number but instead as the word: five.


How many words in the Lingala language?

It is not possible to count the exact number of words in any language, for a variety of reasons, but Lingala has between 40,000 and 150,000 words.