Write a code to count the no.of 1s in a given 16 bit integer.
int count = 0; while (number != 0) { if (number % 10 == 1) count ++; number /= 10; }
There are currently 1 users browsing this thread. (0 members and 1 guests)
View Tag Cloud
Forum Rules
Bookmarks