Hi guys, as you can see i have a problem with the array , i don t know how to put every remainder in the
array and then loop it to get the reverse order, it seems that the array is being overwrited every time
the while loop goes and i don t know how to handle this.
int dec_num;
int remainder;
int result;
int n = 0;
int[] Storage = new int[10];
Console.WriteLine("Unesite broj koji zelite pretvoriti");
dec_num = int.Parse(Console.ReadLine());
while (dec_num > 0)
{
result = dec_num / 2;
remainder = dec_num % 2;
Storage[n] = remainder;
dec_num = dec_num / 2;
Console.WriteLine("The Result is " + result + "" + " and the remainder " + remainder);
}
for (int i = Storage[0]; i < Storage.Length; i++)
Console.WriteLine(Storage[n]);
Console.ReadLine();