Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
decimal to binary
//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) { int num; Console.Write("Enter a Number : "); num = int.Parse(Console.ReadLine()); int quot; string rem = ""; while (num >= 1) { quot = num / 2; rem += (num % 2).ToString(); num = quot; } string bin = ""; for (int i = rem.Length - 1; i >= 0; i--) { bin = bin + rem[i]; } Console.WriteLine("The Binary format for given number is {0}", bin); Console.Read(); } } }
run
|
edit
|
history
|
help
1
sample code
Detaylar
yari
Reverse String and Binary Search of floating point values
Test Stopwatch
Math 10.81 added quad seq
ray's 2nd test
type experriment
up casting down casting
Intuit // C# // listing_4.10 (for..)