'''
Assignment No: 10
To input binary number from user and convert it into decimal number.
'''
def binaryToDecimal(binary): # function definition
binary1 = binary
decimal, i, n = 0, 0, 0
while(binary != 0):
dec = binary % 10
decimal = decimal + dec * pow(2, i)
binary = binary//10
i += 1
print(decimal)
# Driver code
if __name__ == '__main__':
binaryToDecimal(100)
binaryToDecimal(101)
binaryToDecimal(1001)
Assignment No: 10
To input binary number from user and convert it into decimal number.
'''
def binaryToDecimal(binary): # function definition
binary1 = binary
decimal, i, n = 0, 0, 0
while(binary != 0):
dec = binary % 10
decimal = decimal + dec * pow(2, i)
binary = binary//10
i += 1
print(decimal)
# Driver code
if __name__ == '__main__':
binaryToDecimal(100)
binaryToDecimal(101)
binaryToDecimal(1001)
Easy to understand
ReplyDeleteπ
DeleteVery nice program and easy to understand
ReplyDeleteππ
DeleteThis is very easy
ReplyDeleteπππ
DeleteVery easy it is
ReplyDeleteππππ
DeleteEasy one
ReplyDeleteπππππ
DeleteVery easy
ReplyDeleteEasyπ
ReplyDeleteThanks for comment
DeleteEasy to understand
ReplyDeleteπ
Deleteπ
ReplyDeleteThanks for comment
DeleteDoneπ
ReplyDeleteThanks
DeleteNice practical
ReplyDeleteπ
DeleteNiceπππ
ReplyDeleteπ
DeleteUnderstanding
ReplyDeleteEasy
ReplyDeleteTHANKS
DeleteEasy
ReplyDeleteThanks for comment
DeleteEasy practical and better understanding
ReplyDeleteEasy to do binary digit in decimal or decimal to binary no.
ReplyDeleteBinary operation are used in this programme to convert binary to decimal
ReplyDeleteStudents are also convert decimal to hex
ReplyDeleteEasy to understand ππ
ReplyDeleteThanks Prajwal
DeleteNice sir learn many things from this program
ReplyDeleteπ
DeleteEasy to understand
ReplyDeleteThanks Sanket
DeleteUnderstandable
ReplyDeleteTHANKS
DeleteTHANKS
DeleteEasy to understand
ReplyDeleteπ
DeleteSuccessfully...π
ReplyDeleteThanks Sanika
DeleteThanks
ReplyDeleteThanks vaishnavi
ReplyDeleteUnderstand
ReplyDeleteEasy to understand
ReplyDeleteVery simple and easy to understand
ReplyDeleteUnderstand
ReplyDeleteUnderstood
ReplyDeleteEasy to understand
ReplyDeleteEasy
ReplyDeleteEasy to understand
ReplyDeleteEasy to understand
ReplyDeleteKddk... ....
ReplyDeleteIt is easy to do decimal numbers into binary or vice versa.
ReplyDeleteProgram are run sir
ReplyDeleteI'll understand
Roll No= 09
ReplyDeleteBatch No= A1