HeYa Brainlians!!
Challenge 4 u
Q) WAP in JAVA to convert the string input by the user and convert it to the binary cödes.
Ex:
Sample input:
A
Output:
1000001
Hint: Use ASCII côdes
_
Answers
Answered by
10
Attachments:
Answered by
1
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.
C++
// C++ program to convert
// string into binary string
#include <bits/stdc++.h>
using namespace std;
//
Attachments:
Similar questions
English,
1 month ago
Chemistry,
1 month ago
Math,
2 months ago
CBSE BOARD X,
2 months ago
Hindi,
9 months ago
Social Sciences,
9 months ago