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; prog pg = new prog(); Console.WriteLine("Enter a decimal number: "); num = int.Parse(Console.ReadLine()); Console.WriteLine("The binary equivalent of num is :"); pg.binaryconversion(num); Console.ReadLine(); } } public class prog { public int binaryconversion(int num) { int bin; if (num != 0) { bin = (num % 2) + 10 * binaryconversion(num / 2); Console.Write(bin); return 0; } else { return 0; } } } }
run
|
edit
|
history
|
help
1
Overriding fields
Fórum ➡ Finding STRONG tags that contain UL tags, using Regex class♦
a6
Lambda Expressions Are Cool
newDivQ DONE - adding UniqueShuffle
Explicit Interface Examplle
lookup test
Valida Fechas futuras
All
actions and tasks