## Easily Convert Decimal Numbers To Their Binary And BCD Formats

4 stars based on 42 reviews

This forum is now read-only. Please use our new forums at write a c program to convert decimal to binary number using array. I would like just the functions, patterns, variables and other things I might need for it. I think I would need a variable for binary converter but I am not sure. Ok, first you need to understand how to convert from decimal and binary and back on paper. Remembering binary is base 2 and decimal is base From decimal to binary: You can use the division method.

So take a number say Then repeat the mod, div process until your number is 0. This will leave you with a list of 1's and 0's in the case of All you have to do now is reverse that number to get the correct binary number: From binary to decimal: This is slightly easier. For example take binary: Hope you understand how binary and decimal conversions work in theory, so all you need to do now is convert the text explanation above into code.

Good luck and have fun. If you get stuck, paste your code using codeblocks and i'll try help point you in the right direction. Nathaniel over 4 years ago. I want to gather a list. Simon Urban over 4 years ago. I'm afraid I don't know how I can help you write a c program to convert decimal to binary number using array more without coding the whole program for you.

I have already coded such a program in C. I think once you understand what is required to code, you'll be able to work out what variable, etc. I can't just say: Here's my code from my C program for Decimal to Binary: The Binary to Decimal is a slight cheat because in Cyou can convert a string to any given base e.

Hope the code gives you some pointers as to what you might require. Course Forum Section 2 Coding a program which converts binary in to de Coding a program which converts binary in to decimal and visa versa. Simon Urban over 4 years ago I'm afraid I don't know how I can help you any more without coding the whole program for you.