Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
de Decimal a Binario
//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) { //Your code goes here Console.WriteLine("Hello, world!"); int n = 38; int [] aBin = new int [] {32,16,8,4,2,1}; int [] ourNumber = new int [aBin.Length]; for ( int i = 0; i < aBin.Length ; i++ ) { if ( n >= aBin[i] ) { ourNumber[i] += 1; n -= aBin[i]; } else { ourNumber[i] = 0; } } foreach(var item in ourNumber) { Console.Write(item.ToString()); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
HelloWorld
Roman Numbers - Sorting
pattern2
Hex_Base64
Stacks: Balanced Brackets
Date Diff
Konsol Üçgen Çizimi
CRM_Datum
Scheduler NLog config
jjj4
stackse - search stackoverflow differently
Please log in to post a comment.