Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Code which will convert Word into its Binary Format
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Code which will convert Word into its Binary Format Console.WriteLine("Hello, Am program which will convert Word into its Binary Format!"); int dec = 0; string binStr = string.Empty; string sFullBinStr = string.Empty; string text = Console.ReadLine(); Console.WriteLine("Value: "+text); char[] arr = text.ToCharArray(); for (int i = 0; i < arr.Length; i++) { Console.WriteLine("Each Char:- "+arr[i] + " and it's ASCII Value:- "+ Convert.ToUInt16(arr[i])); dec = Convert.ToUInt16(arr[i]); while (dec > 0) { binStr = binStr.Insert(0, (dec % 2).ToString()); dec /= 2; } Console.WriteLine("Binary Value:- "+binStr); sFullBinStr = sFullBinStr + " "+ binStr; binStr = string.Empty; } Console.WriteLine("Binary Value of Word:- "+sFullBinStr); } } }
run
|
edit
|
history
|
help
0
First Program
Find duplicates in a given integer array
Animal generator (Under construction!)
asxsdxasd sd
Prime Number
dsritureoit
C# enum flag comparison with bitwise operators
Byte array to base 64 string
Math 9.5
-Wall -std=c++14 -O0 -o a.out source_file.cpp