A] Given a Decimal number(base 10) convert it to binary (base-2). Print the binary representation of the number and print the count of 1's and 0's present in binary representation.
Example: input: 5
Output: Binary Representation: 101
Total Number of 1's: 2
Total Number of 0's: 1
Answers
Answered by
0
do go to to to go go go in roblox I don't know what
Answered by
0
Given: decimal number with base 10
1- 7
2- 10
To find :
Binary form of 7 and 10
Also number of 1's and 0's present in that binary number
SOLUTION:
Converting decimal to binary,
Dividing by 2 till quotient became 0 and write all the remainders
We get,
111 in binary
Number of 1's =3
Number of 0's=0
Now ,
Converting 10 decimal to binary :
Divide 10 by 2 as base of binaryis two till quotient become 0
= 1010 in binary
Number of 1's=2
Number of 2's =2
Answer: Binary form of 7 is 111 and number of 1's are 3 and number of 0's are 0
Answer: Binary form of 7 is 111 and number of 1's are 3 and number of 0's are 0Binary form of 10 us 1010 and number of 1's and 0's are 2.
Similar questions
Physics,
6 hours ago
English,
6 hours ago
Hindi,
6 hours ago
Social Sciences,
12 hours ago
Social Sciences,
12 hours ago
Science,
8 months ago
English,
8 months ago