This is my whole code :
using System;
namespace start
{
class Program
{
static void Main(string[] args)
{
while (true)
{
try
{
string nevim = ""; // prázdná proměnná pro zbytek
Console.WriteLine("zadej číslo, které chceš převést do binární soustavy: ");
ulong vstup = ulong.Parse(Console.ReadLine()); // uložíme vstup do proměnné
while (vstup > 0) //pokud je vstup větší než 0
{
ulong pocet = vstup % 2; // zjistí zbytek po dělení dvojkou
nevim = nevim + pocet; // do proměnné přidá zbytek
vstup = vstup / 2; // zadané číslo vydělí 2
}
char[] array = nevim.ToCharArray();
Array.Reverse(array); //otočí výsledek
Console.WriteLine(array);
Console.WriteLine(array + "test");
Console.ReadKey();
}
catch
{
Console.Clear();
Console.WriteLine("nastala nějaká chyba TYY GEJI");
Console.WriteLine("stiskni libovolné tlačítko pro pokračování");
Console.ReadKey();
Console.Clear();
}
}
}
}
}
i tried "To.CharArray convert method" to reverse the string, when i try to get the output its ok, for example:
input = 123
output:
1111011
but when i try to add something to output like:
Console.WriteLine(array + "test");
the output is:
System.Char[]test
and i want this as output:
1111011 test
Any ideas?