Ask your own question, for FREE!
Computer Science 61 Online
OpenStudy (anonymous):

Please teach me some ways on how to convert an integer to a binary digits. thanks.

OpenStudy (anonymous):

Well, show us what you've got so far.

OpenStudy (rsmith6559):

This function, with base 2, will do it. It just needs a main() written for it. #include <stdio.h> #include <stdlib.h> int mkDigit( int number, int base, char* answer ) { char characters[] = { "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }; int remainder, index; if( number == 0 ) return( 0 ); remainder = number % base; number /= base; index = mkDigit( number, base, answer ); answer[ index ] = characters[ remainder ]; return( ++index ); }

OpenStudy (anonymous):

i don't think he asked for a program just google how to convert decimal to binary

OpenStudy (rsmith6559):

True, but the algorithm still shows.

OpenStudy (anonymous):

tell != teach

OpenStudy (farmdawgnation):

I agree with @nczempin above, personally. Please do note we have a new clause in our Code of Conduct that reads "Don’t post only answers - guide the asker to a solution."

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Sleep: Rate my lame art
3 hours ago 13 Replies 2 Medals
ykbatman: Why do you think valentines day is a holiday, and such a popular one?
33 minutes ago 9 Replies 3 Medals
Twaylor: is 2 credits and 5 f's but 1 d enough to pass being a sophomore
4 hours ago 29 Replies 2 Medals
Twaylor: is 2 credits enough to pass being a sophtmore
6 hours ago 0 Replies 0 Medals
Twaylor: what is the best milk (store type you dirty [bleeps]
7 hours ago 0 Replies 0 Medals
Gucchi: programming help
4 hours ago 33 Replies 3 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!