C Program To Convert Decimal Number To Binary Number, using While Loop

preview_player
Показать описание

Lets write a C program convert a number from Decimal number system(base 10) to Binary number system(base 2), using while loop.

Note: Binary number system can be derived by base 2 to the power of whole numbers.

Expected Output for the Input
User Input:
Enter a decimal number
14

Output:
Binary equivalent of 14 is 1110

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

Thank you. Great explanation and it made a lot of sense how you went through the logic. As soon as you introduced your variables I realized why my code wasn’t working. Thank you great vid

joshuapalomares
Автор

sir, when you are calculating the 19th decimal into binary equivalent, you got the wrong number like 16+8+4+2+1=31. how it is possible?

srps
Автор

Hi! Can you do a sample loop using java same problem decimal to binary. Thank you

loriejanedialoring
Автор

Sir actually binary representation of 8 is 1000, at start there was a error in ur chart, 2%2 is 0 and not 1

Im_RajSingh
Автор

Sir why we use printf bin ??and why its outside of loop?

dlwpdle
Автор

I dont understand why we need place = place * 10?
what is have us? +

dvatsetsem
Автор

awesome work!! the text of the C code was so nice and large!! so clear... great job!!! clap clap clap clap!!!

jesusstudentbrett
Автор

Dear sir, Can you explain a c program to find my lucky number once i enter my birthday as, year, month, date. (lucky number = year+ month+date, and digit adding continue until gets lucky number that is single digit integer") thank you

tinula
Автор

How can i make it 8 bits binary for example if number is 5 instead of 101, i want it to be like

bishalbhandari
Автор

Yeah, what about the numbers that are above the range of Int? It sucks.

partiid
Автор

You have made it so complex. No need to do with bin & place. It can be done only by num & rem.

kuntalsur
Автор

when I am putting 4 digit program, not working as a decimal to binary idkw

RohitKumar-oigc
Автор

Where is decimal number input
While(num) X
While (num!=0) correct

factworldpresents
Автор

When I use a high number, like 2000, the algorithm returns a wrong number, how can I solve this?

murieldebonaportonguarezi
Автор

Only able to convert 2 digit nos not 3 digit

goldenwind
Автор

u said decimal but u are doing only for integers. Change your title please

mohithmvs
Автор

The flaw of this program is, if the binary number starts with 0, it wont print it

EternalBlaze