Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Move 2 ushort to 1 int
//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 ushort[] arrLect = new ushort[4]; arrLect[0] = 15; arrLect[1] = 240; arrLect[2] = 3840; arrLect[3] = 61440; for (int iArr = 0; iArr < arrLect.Length; iArr++) { Console.WriteLine("BIN: " + Convert.ToString(arrLect[iArr], 2).PadLeft(16, '0') + " - DEC: " + arrLect[iArr].ToString()); } int val = 0; ushort mask = (ushort)(1 << 0); val |= arrLect[0] & mask; val |= (arrLect[0] & mask) << 16; Console.WriteLine(""); Console.WriteLine("BIN: " + "| 7|| 6|| 5|| 4|| 3|| 2|| 1|| 0|"); Console.WriteLine("BIN: " + Convert.ToString(mask, 2).PadLeft(32, '0') + " - DEC: " + mask.ToString()); Console.WriteLine("BIN: " + Convert.ToString(val, 2).PadLeft(32, '0') + " - DEC: " + val.ToString()); } } }
run
|
edit
|
history
|
help
0
teste
Interviews
sdefrgthyjuiujyhtgrf
dsfafasd
2.2 gz
hello world
if Two Words Are Anagrams of Each Other
quadratics
useful
temp_with_pow