Given a string of character the task is to convert each character of a string into the equivalent binary number.
Input : GFG Output : 1000111 1000110 1000111 Input : geeks Output : 1100111 1100101 1100101 1101011 1110011
The idea is to first calculate the length of the string as n and then run a loop n times. In each iteration store ASCII value of character in variable val and then convert it into binary number and store result in array finally print the array in reverse order.
1100111 1100101 1100101 1101011 1110011
- Convert an unbalanced bracket sequence to a balanced sequence
- Minimum steps to convert one binary string to other only using negation
- Minimum operations required to convert a binary string to all 0s or all 1s
- Minimum swaps required to convert one binary string to another
- Convert a sentence into its equivalent mobile numeric keypad sequence
- Minimum number of given operations required to convert a string to another string
- Convert the string into palindrome string by changing only one character.
- Convert Hexadecimal value String to ASCII value String
- Convert Binary fraction to Decimal
- String with additive sequence
- Convert Ternary Expression to a Binary Tree
- Convert decimal fraction to binary number
- Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array | Set-2
- Lexicographically largest sub-sequence of the given string
- Replace every consonant sequence with its length in the given string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.