+ 1
it's supposed to take a hexa decimal number turn it into binary and then print the 1's in the binary.the first i'm getting right
6 ответов
+ 1
if you want to take hexadecimal as a input from the user..
so
used
this
scanf("%i",&a);
%i
take input
as
decimal number
octal number
and
hexadecimal number
......
i hope this program will help you ti understand better
https://code.sololearn.com/c2xHtxgkwBTQ/?ref=app
+ 1
1. The gets function was removed in the C11 standard.
2. The entered string can be converted to a long value using strtol or strtoul so there is no need for your wierd switch case block.
3. A simple for loop can shift through the long value to determine the number of 1's and generate the binary string pattern at the same time."
What did they replace the getter method with?
0
not what i meant.you see the if you input 11 it gives me 0001001 (correct) and 5.but the 1's in binary are 2 but it gives me 5. check the editted code.