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
726
printing * in pyramid shape
x=msgbox("Your Message Here", Button+Icon, "Your Title Here")
Free v Bucks Codes
Random name switch
adxasxsd
sdfgyutresdf
Binary search tree - In-order Traversal
comb sort
asifuesire