Convert Decimal to binary using python 2.7
Steps to convert Decimalto binary
step 2:-record remainder from step1 as the rightmost digits
step 3:-divide the quotient of previous by 2
step 4:-record remainder from step3 as the next rightmost digits
step 5:-repeat untill zero at quotient
I specially recommend to use second second code (arithmetic logic code)
Output of prog using define fun.
python NoConv.py Enter Number in decimal form > 3 3 in binary = 0b11 ********** Enter x to end program or y to convert >y Enter Number in decimal form > 4 4 in binary = 0b100 ********** Enter x to end program or y to convert >x
Output of prog using arithmetic
rushi\Desktop\>python NoConv.py Enter input > 33 33 in binary :- 1 0 0 0 0 1 PS C:\Users\rushi\Desktop\mypyDec>
No comments:
Post a Comment